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

Side by Side Diff: google_apis/google_api_keys.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 // This is used as a lazy instance to determine keys once and cache them. 92 // This is used as a lazy instance to determine keys once and cache them.
93 class APIKeyCache { 93 class APIKeyCache {
94 public: 94 public:
95 APIKeyCache() { 95 APIKeyCache() {
96 scoped_ptr<base::Environment> environment(base::Environment::Create()); 96 scoped_ptr<base::Environment> environment(base::Environment::Create());
97 CommandLine* command_line = CommandLine::ForCurrentProcess(); 97 CommandLine* command_line = CommandLine::ForCurrentProcess();
98 98
99 api_key_ = CalculateKeyValue(GOOGLE_API_KEY, 99 api_key_ = CalculateKeyValue(GOOGLE_API_KEY,
100 STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY), 100 STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY),
101 NULL, "", 101 NULL,
102 std::string(),
102 environment.get(), 103 environment.get(),
103 command_line); 104 command_line);
104 105
105 std::string default_client_id = CalculateKeyValue( 106 std::string default_client_id =
106 GOOGLE_DEFAULT_CLIENT_ID, 107 CalculateKeyValue(GOOGLE_DEFAULT_CLIENT_ID,
107 STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), 108 STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID),
108 NULL, "", 109 NULL,
109 environment.get(), 110 std::string(),
110 command_line); 111 environment.get(),
111 std::string default_client_secret = CalculateKeyValue( 112 command_line);
112 GOOGLE_DEFAULT_CLIENT_SECRET, 113 std::string default_client_secret =
113 STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), 114 CalculateKeyValue(GOOGLE_DEFAULT_CLIENT_SECRET,
114 NULL, "", 115 STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET),
115 environment.get(), 116 NULL,
116 command_line); 117 std::string(),
118 environment.get(),
119 command_line);
117 120
118 // We currently only allow overriding the baked-in values for the 121 // We currently only allow overriding the baked-in values for the
119 // default OAuth2 client ID and secret using a command-line 122 // default OAuth2 client ID and secret using a command-line
120 // argument, since that is useful to enable testing against 123 // argument, since that is useful to enable testing against
121 // staging servers, and since that was what was possible and 124 // staging servers, and since that was what was possible and
122 // likely practiced by the QA team before this implementation was 125 // likely practiced by the QA team before this implementation was
123 // written. 126 // written.
124 client_ids_[CLIENT_MAIN] = CalculateKeyValue( 127 client_ids_[CLIENT_MAIN] = CalculateKeyValue(
125 GOOGLE_CLIENT_ID_MAIN, 128 GOOGLE_CLIENT_ID_MAIN,
126 STRINGIZE_NO_EXPANSION(GOOGLE_CLIENT_ID_MAIN), 129 STRINGIZE_NO_EXPANSION(GOOGLE_CLIENT_ID_MAIN),
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 241
239 std::string GetOAuth2ClientID(OAuth2Client client) { 242 std::string GetOAuth2ClientID(OAuth2Client client) {
240 return g_api_key_cache.Get().GetClientID(client); 243 return g_api_key_cache.Get().GetClientID(client);
241 } 244 }
242 245
243 std::string GetOAuth2ClientSecret(OAuth2Client client) { 246 std::string GetOAuth2ClientSecret(OAuth2Client client) {
244 return g_api_key_cache.Get().GetClientSecret(client); 247 return g_api_key_cache.Get().GetClientSecret(client);
245 } 248 }
246 249
247 } // namespace google_apis 250 } // namespace google_apis
OLDNEW
« no previous file with comments | « google_apis/gaia/oauth_request_signer_unittest.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698