Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5718)

Unified Diff: chrome/browser/search/search.cc

Issue 134013004: [OriginChip] Add options for the position of the origin chip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/search.cc
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index d4387a18643cd922a5af636bcad74afaa67f0430..0436353682e7b122cd6b2cdb554f9c5d77ad85a0 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -69,7 +69,7 @@ const char kUseCacheableNTP[] = "use_cacheable_ntp";
const char kPrefetchSearchResultsFlagName[] = "prefetch_results";
const char kPrefetchSearchResultsOnSRP[] = "prefetch_results_srp";
const char kDisplaySearchButtonFlagName[] = "display_search_button";
-const char kEnableOriginChipFlagName[] = "origin_chip";
+const char kOriginChipFlagName[] = "origin_chip";
#if !defined(OS_IOS) && !defined(OS_ANDROID)
const char kEnableQueryExtractionFlagName[] = "query_extraction";
#endif
@@ -546,16 +546,30 @@ DisplaySearchButtonConditions GetDisplaySearchButtonConditions() {
}
bool ShouldDisplayOriginChip() {
+ return GetOriginChipPosition() != ORIGIN_CHIP_DISABLED;
+}
+
+OriginChipPosition GetOriginChipPosition() {
const CommandLine* cl = CommandLine::ForCurrentProcess();
if (cl->HasSwitch(switches::kDisableOriginChip)) {
- return false;
- } else if (cl->HasSwitch(switches::kEnableOriginChip)) {
- return true;
+ return ORIGIN_CHIP_DISABLED;
+ } else if (cl->HasSwitch(switches::kEnableOriginChipLeadingLocationBar)) {
+ return ORIGIN_CHIP_LEADING_LOCATION_BAR;
+ } else if (cl->HasSwitch(switches::kEnableOriginChip) ||
+ cl->HasSwitch(switches::kEnableOriginChipTrailingLocationBar)) {
+ return ORIGIN_CHIP_TRAILING_LOCATION_BAR;
+ } else if (cl->HasSwitch(switches::kEnableOriginChipLeadingMenuButton)) {
+ return ORIGIN_CHIP_LEADING_MENU_BUTTON;
}
FieldTrialFlags flags;
- return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault(
- kEnableOriginChipFlagName, false, flags);
+ if (!GetFieldTrialInfo(&flags))
+ return ORIGIN_CHIP_DISABLED;
+ uint64 value =
+ GetUInt64ValueForFlagWithDefault(kOriginChipFlagName, 0, flags);
+ return (value < ORIGIN_CHIP_NUM_VALUES) ?
+ static_cast<OriginChipPosition>(value) :
+ ORIGIN_CHIP_DISABLED;
}
GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) {
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698