Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "components/metrics/proto/omnibox_event.pb.h" | 16 #include "components/metrics/proto/omnibox_event.pb.h" |
| 17 #include "components/metrics/proto/omnibox_input_type.pb.h" | 17 #include "components/omnibox/browser/autocomplete_input.h" |
| 18 #include "components/omnibox/browser/autocomplete_match_type.h" | 18 #include "components/omnibox/browser/autocomplete_match_type.h" |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 struct Feature; | 21 struct Feature; |
| 22 class TimeDelta; | 22 class TimeDelta; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace omnibox { | 25 namespace omnibox { |
| 26 | 26 |
| 27 extern const base::Feature kNewOmniboxAnswerTypes; | 27 extern const base::Feature kNewOmniboxAnswerTypes; |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 // Returns the relevance score that KeywordProvider should assign to keywords | 367 // Returns the relevance score that KeywordProvider should assign to keywords |
| 368 // with sufficiently-complete matches, i.e., the user has typed all of the | 368 // with sufficiently-complete matches, i.e., the user has typed all of the |
| 369 // important part of the keyword. Returns -1 if the experiment isn't active. | 369 // important part of the keyword. Returns -1 if the experiment isn't active. |
| 370 static int KeywordScoreForSufficientlyCompleteMatch(); | 370 static int KeywordScoreForSufficientlyCompleteMatch(); |
| 371 | 371 |
| 372 // --------------------------------------------------------- | 372 // --------------------------------------------------------- |
| 373 // For the EmphasizeTitles experiment that's part of the bundled omnibox | 373 // For the EmphasizeTitles experiment that's part of the bundled omnibox |
| 374 // field trial. | 374 // field trial. |
| 375 | 375 |
| 376 // Returns the conditions under which the UI code should display the title | 376 // Returns the conditions under which the UI code should display the title |
| 377 // of a URL more prominently than the URL for an input of type |input_type|. | 377 // of a URL more prominently than the URL for an input of type |input_type|. |
|
Mark P
2017/02/28 22:24:28
Revise this.
gcomanici
2017/03/01 02:56:28
Done.
| |
| 378 // Normally the URL is displayed more prominently. Returns NEVER_EMPHASIZE | 378 // Normally the URL is displayed more prominently. Returns NEVER_EMPHASIZE |
| 379 // if the experiment isn't active. | 379 // if the experiment isn't active. |
| 380 static EmphasizeTitlesCondition GetEmphasizeTitlesConditionForInput( | 380 static EmphasizeTitlesCondition GetEmphasizeTitlesConditionForInput( |
| 381 metrics::OmniboxInputType::Type input_type); | 381 const AutocompleteInput& input); |
| 382 | 382 |
| 383 // --------------------------------------------------------- | 383 // --------------------------------------------------------- |
| 384 // For PhysicalWebProvider related experiments. | 384 // For PhysicalWebProvider related experiments. |
| 385 | 385 |
| 386 // Returns whether the user is in a Physical Web field trial where the | 386 // Returns whether the user is in a Physical Web field trial where the |
| 387 // PhysicalWebProvider should be used to get suggestions when the user clicks | 387 // PhysicalWebProvider should be used to get suggestions when the user clicks |
| 388 // on the omnibox but has not typed anything yet. | 388 // on the omnibox but has not typed anything yet. |
| 389 static bool InPhysicalWebZeroSuggestFieldTrial(); | 389 static bool InPhysicalWebZeroSuggestFieldTrial(); |
| 390 | 390 |
| 391 // Returns whether the user is in a Physical Web field trial and URL-based | 391 // Returns whether the user is in a Physical Web field trial and URL-based |
| 392 // suggestions can continue to appear after the user has started typing. | 392 // suggestions can continue to appear after the user has started typing. |
| 393 static bool InPhysicalWebAfterTypingFieldTrial(); | 393 static bool InPhysicalWebAfterTypingFieldTrial(); |
| 394 | 394 |
| 395 // Returns the base relevance score for Physical Web omnibox suggestions when | 395 // Returns the base relevance score for Physical Web omnibox suggestions when |
| 396 // the user has clicked on the omnibox but has not typed anything yet. | 396 // the user has clicked on the omnibox but has not typed anything yet. |
| 397 static int GetPhysicalWebZeroSuggestBaseRelevance(); | 397 static int GetPhysicalWebZeroSuggestBaseRelevance(); |
| 398 | 398 |
| 399 // Returns the base relevance score for Physical Web omnibox suggestions when | 399 // Returns the base relevance score for Physical Web omnibox suggestions when |
| 400 // the user has started typing in the omnibox. | 400 // the user has started typing in the omnibox. |
| 401 static int GetPhysicalWebAfterTypingBaseRelevance(); | 401 static int GetPhysicalWebAfterTypingBaseRelevance(); |
| 402 | 402 |
| 403 // --------------------------------------------------------- | 403 // --------------------------------------------------------- |
| 404 // For experiment redirecting zero suggest requests to a service provided by | 404 // For experiment redirecting zero suggest requests to a service provided by |
| 405 // the Chrome team. | 405 // the Chrome team. |
| 406 | 406 |
| 407 // Returns whether the user is in the field trial which redirects zero suggest | 407 // Returns true whether the user is in the field trial which redirects zero |
| 408 // requests to the service provided by the Chrome team. | 408 // suggest requests to the service provided by the Chrome team. |
| 409 static bool InZeroSuggestRedirectToChromeFieldTrial(); | 409 static bool InZeroSuggestRedirectToChromeFieldTrial(); |
| 410 | 410 |
| 411 // Returns a string representing the address of the server where the zero | 411 // Returns a string representing the address of the server where the zero |
| 412 // suggest requests are being redirected. The return value is a URL | 412 // suggest requests are being redirected. The return value is a URL |
| 413 // (https://example.com/test) and it doesn't include any query component | 413 // (https://example.com/test) and it doesn't include any query component |
| 414 // (no "?"). | 414 // (no "?"). |
| 415 static std::string ZeroSuggestRedirectToChromeServerAddress(); | 415 static std::string ZeroSuggestRedirectToChromeServerAddress(); |
| 416 | 416 |
| 417 // Returns a string representing the parameters that are sent to the | 417 // Returns a string representing the parameters that are sent to the |
| 418 // alternative service providing zero suggestions. The returned value is | 418 // alternative service providing zero suggestions. The returned value is |
| 419 // properly escaped. It can be appended to the string representaiton of a | 419 // properly escaped. It can be appended to the string representaiton of a |
| 420 // request URL. | 420 // request URL. |
| 421 static std::string ZeroSuggestRedirectToChromeAdditionalFields(); | 421 static std::string ZeroSuggestRedirectToChromeAdditionalFields(); |
| 422 | 422 |
| 423 // Returns true whether the user is in the field trial which swaps the title | |
| 424 // and the URL for zero suggest suggestions. | |
| 425 static bool InZeroSuggestSwapTitleAndUrlFieldTrial(); | |
| 426 | |
| 423 // --------------------------------------------------------- | 427 // --------------------------------------------------------- |
| 424 // Exposed publicly for the sake of unittests. | 428 // Exposed publicly for the sake of unittests. |
| 425 static const char kBundledExperimentFieldTrialName[]; | 429 static const char kBundledExperimentFieldTrialName[]; |
| 426 // Rule names used by the bundled experiment. | 430 // Rule names used by the bundled experiment. |
| 427 static const char kDisableProvidersRule[]; | 431 static const char kDisableProvidersRule[]; |
| 428 static const char kShortcutsScoringMaxRelevanceRule[]; | 432 static const char kShortcutsScoringMaxRelevanceRule[]; |
| 429 static const char kSearchHistoryRule[]; | 433 static const char kSearchHistoryRule[]; |
| 430 static const char kDemoteByTypeRule[]; | 434 static const char kDemoteByTypeRule[]; |
| 431 static const char kHQPBookmarkValueRule[]; | 435 static const char kHQPBookmarkValueRule[]; |
| 432 static const char kHQPTypedValueRule[]; | 436 static const char kHQPTypedValueRule[]; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 // prioritize different wildcard contexts, see the implementation. How to | 507 // prioritize different wildcard contexts, see the implementation. How to |
| 504 // interpret the value is left to the caller; this is rule-dependent. | 508 // interpret the value is left to the caller; this is rule-dependent. |
| 505 static std::string GetValueForRuleInContext( | 509 static std::string GetValueForRuleInContext( |
| 506 const std::string& rule, | 510 const std::string& rule, |
| 507 metrics::OmniboxEventProto::PageClassification page_classification); | 511 metrics::OmniboxEventProto::PageClassification page_classification); |
| 508 | 512 |
| 509 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 513 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
| 510 }; | 514 }; |
| 511 | 515 |
| 512 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 516 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| OLD | NEW |