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

Side by Side Diff: components/omnibox/browser/omnibox_field_trial.cc

Issue 1260033003: Partially componentize //chrome/browser/search/search.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 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 unified diff | Download patch
OLDNEW
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 #include "components/omnibox/browser/omnibox_field_trial.h" 5 #include "components/omnibox/browser/omnibox_field_trial.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 const std::string& rule, 476 const std::string& rule,
477 OmniboxEventProto::PageClassification page_classification) { 477 OmniboxEventProto::PageClassification page_classification) {
478 VariationParams params; 478 VariationParams params;
479 if (!variations::GetVariationParams(kBundledExperimentFieldTrialName, 479 if (!variations::GetVariationParams(kBundledExperimentFieldTrialName,
480 &params)) { 480 &params)) {
481 return std::string(); 481 return std::string();
482 } 482 }
483 const std::string page_classification_str = 483 const std::string page_classification_str =
484 base::IntToString(static_cast<int>(page_classification)); 484 base::IntToString(static_cast<int>(page_classification));
485 const std::string instant_extended = 485 const std::string instant_extended =
486 chrome::IsInstantExtendedAPIEnabled() ? "1" : "0"; 486 search::IsInstantExtendedAPIEnabled() ? "1" : "0";
487 // Look up rule in this exact context. 487 // Look up rule in this exact context.
488 VariationParams::const_iterator it = params.find( 488 VariationParams::const_iterator it = params.find(
489 rule + ":" + page_classification_str + ":" + instant_extended); 489 rule + ":" + page_classification_str + ":" + instant_extended);
490 if (it != params.end()) 490 if (it != params.end())
491 return it->second; 491 return it->second;
492 // Fall back to the global page classification context. 492 // Fall back to the global page classification context.
493 it = params.find(rule + ":*:" + instant_extended); 493 it = params.find(rule + ":*:" + instant_extended);
494 if (it != params.end()) 494 if (it != params.end())
495 return it->second; 495 return it->second;
496 // Fall back to the global instant extended context. 496 // Fall back to the global instant extended context.
497 it = params.find(rule + ":" + page_classification_str + ":*"); 497 it = params.find(rule + ":" + page_classification_str + ":*");
498 if (it != params.end()) 498 if (it != params.end())
499 return it->second; 499 return it->second;
500 // Look up rule in the global context. 500 // Look up rule in the global context.
501 it = params.find(rule + ":*:*"); 501 it = params.find(rule + ":*:*");
502 return (it != params.end()) ? it->second : std::string(); 502 return (it != params.end()) ? it->second : std::string();
503 } 503 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698