optimization_guide_enums.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_GUIDE_ENUMS_H_
  5. #define COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_GUIDE_ENUMS_H_
  6. namespace optimization_guide {
  7. // The types of decisions that can be made for an optimization type.
  8. //
  9. // Keep in sync with OptimizationGuideOptimizationTypeDecision in enums.xml.
  10. enum class OptimizationTypeDecision {
  11. kUnknown = 0,
  12. // The optimization type was allowed for the page load by an optimization
  13. // filter for the type.
  14. kAllowedByOptimizationFilter = 1,
  15. // The optimization type was not allowed for the page load by an optimization
  16. // filter for the type.
  17. kNotAllowedByOptimizationFilter = 2,
  18. // An optimization filter for that type was on the device but was not loaded
  19. // in time to make a decision. There is no guarantee that had the filter been
  20. // loaded that the page load would have been allowed for the optimization
  21. // type.
  22. kHadOptimizationFilterButNotLoadedInTime = 3,
  23. // The optimization type was allowed for the page load based on a hint.
  24. kAllowedByHint = 4,
  25. // A hint that matched the page load was present but the optimization type was
  26. // not allowed to be applied.
  27. kNotAllowedByHint = 5,
  28. // A hint was available but there was not a page hint within that hint that
  29. // matched the page load.
  30. kNoMatchingPageHint = 6,
  31. // A hint that matched the page load was on the device but was not loaded in
  32. // time to make a decision. There is no guarantee that had the hint been
  33. // loaded that the page load would have been allowed for the optimization
  34. // type.
  35. kHadHintButNotLoadedInTime = 7,
  36. // No hints were available in the cache that matched the page load.
  37. kNoHintAvailable = 8,
  38. // The OptimizationGuideDecider was not initialized yet.
  39. kDeciderNotInitialized = 9,
  40. // A fetch to get the hint for the page load from the remote Optimization
  41. // Guide Service was started, but was not available in time to make a
  42. // decision.
  43. kHintFetchStartedButNotAvailableInTime = 10,
  44. // Add new values above this line.
  45. kMaxValue = kHintFetchStartedButNotAvailableInTime,
  46. };
  47. // The statuses for racing a hints fetch with the current navigation based
  48. // on the availability of hints for both the current host and URL.
  49. //
  50. // Keep in sync with OptimizationGuideRaceNavigationFetchAttemptStatus in
  51. // enums.xml.
  52. enum class RaceNavigationFetchAttemptStatus {
  53. kUnknown,
  54. // The race was not attempted because hint information for the host and URL
  55. // of the current navigation was already available.
  56. kRaceNavigationFetchNotAttempted,
  57. // The race was attempted for the host of the current navigation but not the
  58. // URL.
  59. kRaceNavigationFetchHost,
  60. // The race was attempted for the URL of the current navigation but not the
  61. // host.
  62. kRaceNavigationFetchURL,
  63. // The race was attempted for the host and URL of the current navigation.
  64. kRaceNavigationFetchHostAndURL,
  65. // A race for the current navigation's URL is already in progress.
  66. kRaceNavigationFetchAlreadyInProgress,
  67. // DEPRECATED: A race for the current navigation's URL was not attempted
  68. // because there were too many concurrent page navigation fetches in flight.
  69. kDeprecatedRaceNavigationFetchNotAttemptedTooManyConcurrentFetches,
  70. // Add new values above this line.
  71. kMaxValue =
  72. kDeprecatedRaceNavigationFetchNotAttemptedTooManyConcurrentFetches,
  73. };
  74. // The statuses for a download file containing a prediction model when verified
  75. // and processed.
  76. //
  77. // Keep in sync with OptimizationGuidePredictionModelDownloadStatus
  78. // in enums.xml.
  79. enum class PredictionModelDownloadStatus {
  80. kUnknown = 0,
  81. // The downloaded file was successfully verified and processed.
  82. kSuccess = 1,
  83. // The downloaded file was not a valid CRX file.
  84. kFailedCrxVerification = 2,
  85. // A temporary directory for unzipping the CRX file failed to be created.
  86. kFailedUnzipDirectoryCreation = 3,
  87. // The CRX file failed to be unzipped.
  88. kFailedCrxUnzip = 4,
  89. // The model info failed to be read from disk.
  90. kFailedModelInfoFileRead = 5,
  91. // The model info failed to be parsed.
  92. kFailedModelInfoParsing = 6,
  93. // The model file was not found in the CRX file.
  94. kFailedModelFileNotFound = 7,
  95. // The model file failed to be moved to a more permanent directory.
  96. kFailedModelFileOtherError = 8,
  97. // The model info was invalid.
  98. kFailedModelInfoInvalid = 9,
  99. // The CRX file was a valid CRX file but did not come from a valid publisher.
  100. kFailedCrxInvalidPublisher = 10,
  101. // The opt guide parent directory for storing models in does not exist.
  102. kOptGuideDirectoryDoesNotExist = 11,
  103. // The new directory to persist this model version's files could not be
  104. // created.
  105. kCouldNotCreateDirectory = 12,
  106. // Add new values above this line.
  107. kMaxValue = kCouldNotCreateDirectory,
  108. };
  109. // The status for the page content annotations being stored.
  110. //
  111. // Keep in sync with OptimizationGuidePageContentAnnotationsStorageStatus in
  112. // enums.xml.
  113. enum PageContentAnnotationsStorageStatus {
  114. kUnknown = 0,
  115. // The content annotations were requested to be stored in the History Service.
  116. kSuccess = 1,
  117. // There were no visits for the URL found in the History Service.
  118. kNoVisitsForUrl = 2,
  119. // The specific visit that we wanted to annotate could not be found in the
  120. // History Service.
  121. kSpecificVisitForUrlNotFound = 3,
  122. // Add new values above this line.
  123. kMaxValue = kSpecificVisitForUrlNotFound,
  124. };
  125. // Different events of the prediction model delivery lifecycle for an
  126. // OptimizationTarget.
  127. // Keep in sync with OptimizationGuideModelDeliveryEvent in enums.xml.
  128. enum class ModelDeliveryEvent {
  129. kUnknown = 0,
  130. // The model was delivered from immediately or after a
  131. // successful download.
  132. kModelDeliveredAtRegistration = 1,
  133. kModelDelivered = 2,
  134. // GetModelsRequest was sent to the optimization guide server.
  135. kGetModelsRequest = 3,
  136. // Model was requested to be downloaded using download service.
  137. kDownloadServiceRequest = 4,
  138. // Download service started the model download.
  139. kModelDownloadStarted = 5,
  140. // Model got downloaded from the download service.
  141. kModelDownloaded = 6,
  142. // Download service was unavailable.
  143. kDownloadServiceUnavailable = 7,
  144. // GetModelsResponse failed.
  145. kGetModelsResponseFailure = 8,
  146. // Download URL received from model metadata is invalid
  147. kDownloadURLInvalid = 9,
  148. // Model download failed due to download service or verifying the downloaded
  149. // model.
  150. kModelDownloadFailure = 10,
  151. // Add new values above this line.
  152. kMaxValue = kModelDownloadFailure,
  153. };
  154. } // namespace optimization_guide
  155. #endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_GUIDE_ENUMS_H_