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

Side by Side Diff: chrome/browser/extensions/api/autotest_private/autotest_private_api.cc

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 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 "chrome/browser/extensions/api/autotest_private/autotest_private_api.h" 5 #include "chrome/browser/extensions/api/autotest_private/autotest_private_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "chrome/browser/extensions/extension_action_manager.h" 9 #include "chrome/browser/extensions/extension_action_manager.h"
10 #include "chrome/browser/extensions/extension_function_registry.h" 10 #include "chrome/browser/extensions/extension_function_registry.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 std::set<std::string> perm_list = 54 std::set<std::string> perm_list =
55 ext->GetActivePermissions()->GetAPIsAsStrings(); 55 ext->GetActivePermissions()->GetAPIsAsStrings();
56 for (std::set<std::string>::const_iterator perm = perm_list.begin(); 56 for (std::set<std::string>::const_iterator perm = perm_list.begin();
57 perm != perm_list.end(); ++perm) { 57 perm != perm_list.end(); ++perm) {
58 permissions->Append(new base::StringValue(perm->c_str())); 58 permissions->Append(new base::StringValue(perm->c_str()));
59 } 59 }
60 return permissions; 60 return permissions;
61 } 61 }
62 62
63 bool IsTestMode(Profile* profile) { 63 bool IsTestMode(Profile* profile) {
64 return AutotestPrivateAPI::GetFactoryInstance() 64 return AutotestPrivateAPI::GetFactoryInstance()->Get(profile)->test_mode();
65 ->GetForProfile(profile)
66 ->test_mode();
67 } 65 }
68 66
69 } // namespace 67 } // namespace
70 68
71 bool AutotestPrivateLogoutFunction::RunImpl() { 69 bool AutotestPrivateLogoutFunction::RunImpl() {
72 DVLOG(1) << "AutotestPrivateLogoutFunction"; 70 DVLOG(1) << "AutotestPrivateLogoutFunction";
73 if (!IsTestMode(GetProfile())) 71 if (!IsTestMode(GetProfile()))
74 chrome::AttemptUserExit(); 72 chrome::AttemptUserExit();
75 return true; 73 return true;
76 } 74 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // This array is volatile not to let compiler optimize us out. 218 // This array is volatile not to let compiler optimize us out.
221 volatile int testarray[3] = {0, 0, 0}; 219 volatile int testarray[3] = {0, 0, 0};
222 220
223 // Cause Address Sanitizer to abort this process. 221 // Cause Address Sanitizer to abort this process.
224 volatile int index = 5; 222 volatile int index = 5;
225 AccessArray(testarray, &index); 223 AccessArray(testarray, &index);
226 } 224 }
227 return true; 225 return true;
228 } 226 }
229 227
230 static base::LazyInstance<ProfileKeyedAPIFactory<AutotestPrivateAPI> > 228 static base::LazyInstance<BrowserContextKeyedAPIFactory<AutotestPrivateAPI> >
231 g_factory = LAZY_INSTANCE_INITIALIZER; 229 g_factory = LAZY_INSTANCE_INITIALIZER;
232 230
233 // static 231 // static
234 ProfileKeyedAPIFactory<AutotestPrivateAPI>* 232 BrowserContextKeyedAPIFactory<AutotestPrivateAPI>*
235 AutotestPrivateAPI::GetFactoryInstance() { 233 AutotestPrivateAPI::GetFactoryInstance() {
236 return g_factory.Pointer(); 234 return g_factory.Pointer();
237 } 235 }
238 236
239 template <> 237 template <>
240 BrowserContextKeyedService* 238 BrowserContextKeyedService*
241 ProfileKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor( 239 BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor(
242 content::BrowserContext* context) const { 240 content::BrowserContext* context) const {
243 return new AutotestPrivateAPI(); 241 return new AutotestPrivateAPI();
244 } 242 }
245 243
246 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { 244 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) {
247 } 245 }
248 246
249 AutotestPrivateAPI::~AutotestPrivateAPI() { 247 AutotestPrivateAPI::~AutotestPrivateAPI() {
250 } 248 }
251 249
252 } // namespace extensions 250 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698