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

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: Fix compilation on iOS 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 const std::string& rule, 490 const std::string& rule,
491 OmniboxEventProto::PageClassification page_classification) { 491 OmniboxEventProto::PageClassification page_classification) {
492 VariationParams params; 492 VariationParams params;
493 if (!variations::GetVariationParams(kBundledExperimentFieldTrialName, 493 if (!variations::GetVariationParams(kBundledExperimentFieldTrialName,
494 &params)) { 494 &params)) {
495 return std::string(); 495 return std::string();
496 } 496 }
497 const std::string page_classification_str = 497 const std::string page_classification_str =
498 base::IntToString(static_cast<int>(page_classification)); 498 base::IntToString(static_cast<int>(page_classification));
499 const std::string instant_extended = 499 const std::string instant_extended =
500 chrome::IsInstantExtendedAPIEnabled() ? "1" : "0"; 500 search::IsInstantExtendedAPIEnabled() ? "1" : "0";
501 // Look up rule in this exact context. 501 // Look up rule in this exact context.
502 VariationParams::const_iterator it = params.find( 502 VariationParams::const_iterator it = params.find(
503 rule + ":" + page_classification_str + ":" + instant_extended); 503 rule + ":" + page_classification_str + ":" + instant_extended);
504 if (it != params.end()) 504 if (it != params.end())
505 return it->second; 505 return it->second;
506 // Fall back to the global page classification context. 506 // Fall back to the global page classification context.
507 it = params.find(rule + ":*:" + instant_extended); 507 it = params.find(rule + ":*:" + instant_extended);
508 if (it != params.end()) 508 if (it != params.end())
509 return it->second; 509 return it->second;
510 // Fall back to the global instant extended context. 510 // Fall back to the global instant extended context.
511 it = params.find(rule + ":" + page_classification_str + ":*"); 511 it = params.find(rule + ":" + page_classification_str + ":*");
512 if (it != params.end()) 512 if (it != params.end())
513 return it->second; 513 return it->second;
514 // Look up rule in the global context. 514 // Look up rule in the global context.
515 it = params.find(rule + ":*:*"); 515 it = params.find(rule + ":*:*");
516 return (it != params.end()) ? it->second : std::string(); 516 return (it != params.end()) ? it->second : std::string();
517 } 517 }
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/search_bouncer.h ('k') | components/omnibox/browser/omnibox_field_trial_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698