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

Side by Side Diff: ui/app_list/app_list_switches.cc

Issue 2842363002: Getting answer server URL from the variations server. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/app_list/app_list_switches.h" 5 #include "ui/app_list/app_list_switches.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial_params.h"
8 #include "build/build_config.h" 9 #include "build/build_config.h"
9 10
10 namespace app_list { 11 namespace app_list {
11 namespace switches { 12 namespace switches {
12 13
13 // If empty, search answers in the app app list are disabled, otherwise the URL 14 // If empty, search answers in the app app list are disabled, otherwise the URL
14 // of the answer server. 15 // of the answer server.
15 const char kAnswerServerUrl[] = "answer-server-url"; 16 const char kAnswerServerUrl[] = "answer-server-url";
16 17
17 // Specifies the chrome-extension:// URL for the contents of an additional page 18 // Specifies the chrome-extension:// URL for the contents of an additional page
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return true; 73 return true;
73 74
74 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 75 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
75 kDisableDriveSearchInChromeLauncher)) 76 kDisableDriveSearchInChromeLauncher))
76 return false; 77 return false;
77 78
78 return true; 79 return true;
79 } 80 }
80 81
81 std::string AnswerServerUrl() { 82 std::string AnswerServerUrl() {
82 return base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( 83 // If the answer server URL is passed in the command line, use it, otherwise
83 kAnswerServerUrl); 84 // get it from the variations server.
85 std::string variations_url = base::GetFieldTrialParamValue(
xiyuan 2017/04/26 23:18:00 nit: get rid of |variations_url| and inline GetFie
vadimt 2017/04/26 23:29:42 See the links I'll send. Quote: // Note: It's i
86 "SearchAnswerCard", switches::kAnswerServerUrl);
87 std::string url =
xiyuan 2017/04/26 23:18:00 nit: const
vadimt 2017/04/26 23:29:42 Done. I like consts, but I'm not using them in Chr
88 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
89 kAnswerServerUrl);
90 return !url.empty() ? url : variations_url;
84 } 91 }
85 92
86 bool IsAnswerCardEnabled() { 93 bool IsAnswerCardEnabled() {
87 return !AnswerServerUrl().empty(); 94 static const bool enabled = !AnswerServerUrl().empty();
95 return enabled;
88 } 96 }
89 97
90 } // namespace switches 98 } // namespace switches
91 } // namespace app_list 99 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698