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

Side by Side Diff: google_apis/google_api_keys.cc

Issue 19925003: WIP - command line experiment Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « google_apis/gaia/gaia_urls.cc ('k') | gpu/command_buffer/service/gpu_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "google_apis/google_api_keys.h" 5 #include "google_apis/google_api_keys.h"
6 6
7 // If you add more includes to this list, you also need to add them to 7 // If you add more includes to this list, you also need to add them to
8 // google_api_keys_unittest.cc. 8 // google_api_keys_unittest.cc.
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 base::Environment* environment, 178 base::Environment* environment,
179 CommandLine* command_line) { 179 CommandLine* command_line) {
180 std::string key_value = baked_in_value; 180 std::string key_value = baked_in_value;
181 std::string temp; 181 std::string temp;
182 if (environment->GetVar(environment_variable_name, &temp)) { 182 if (environment->GetVar(environment_variable_name, &temp)) {
183 key_value = temp; 183 key_value = temp;
184 LOG(INFO) << "Overriding API key " << environment_variable_name 184 LOG(INFO) << "Overriding API key " << environment_variable_name
185 << " with value " << key_value << " from environment variable."; 185 << " with value " << key_value << " from environment variable.";
186 } 186 }
187 187
188 if (command_line_switch && command_line->HasSwitch(command_line_switch)) { 188 if (command_line_switch &&
189 command_line->HasStringSwitch(command_line_switch)) {
189 key_value = command_line->GetSwitchValueASCII(command_line_switch); 190 key_value = command_line->GetSwitchValueASCII(command_line_switch);
190 LOG(INFO) << "Overriding API key " << environment_variable_name 191 LOG(INFO) << "Overriding API key " << environment_variable_name
191 << " with value " << key_value << " from command-line switch."; 192 << " with value " << key_value << " from command-line switch.";
192 } 193 }
193 194
194 if (key_value == DUMMY_API_TOKEN) { 195 if (key_value == DUMMY_API_TOKEN) {
195 #if defined(GOOGLE_CHROME_BUILD) 196 #if defined(GOOGLE_CHROME_BUILD)
196 // No key should be unset in an official build except the 197 // No key should be unset in an official build except the
197 // GOOGLE_DEFAULT_* keys. The default keys don't trigger this 198 // GOOGLE_DEFAULT_* keys. The default keys don't trigger this
198 // check as their "unset" value is not DUMMY_API_TOKEN. 199 // check as their "unset" value is not DUMMY_API_TOKEN.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 241
241 std::string GetOAuth2ClientID(OAuth2Client client) { 242 std::string GetOAuth2ClientID(OAuth2Client client) {
242 return g_api_key_cache.Get().GetClientID(client); 243 return g_api_key_cache.Get().GetClientID(client);
243 } 244 }
244 245
245 std::string GetOAuth2ClientSecret(OAuth2Client client) { 246 std::string GetOAuth2ClientSecret(OAuth2Client client) {
246 return g_api_key_cache.Get().GetClientSecret(client); 247 return g_api_key_cache.Get().GetClientSecret(client);
247 } 248 }
248 249
249 } // namespace google_apis 250 } // namespace google_apis
OLDNEW
« no previous file with comments | « google_apis/gaia/gaia_urls.cc ('k') | gpu/command_buffer/service/gpu_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698