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

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

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 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
12 #include "chrome/browser/extensions/chrome_extension_function.h" 11 #include "chrome/browser/extensions/chrome_extension_function.h"
12 #include "extensions/browser/browser_context_keyed_api_factory.h"
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 class AutotestPrivateLogoutFunction : public ChromeSyncExtensionFunction { 16 class AutotestPrivateLogoutFunction : public ChromeSyncExtensionFunction {
17 public: 17 public:
18 DECLARE_EXTENSION_FUNCTION("autotestPrivate.logout", AUTOTESTPRIVATE_LOGOUT) 18 DECLARE_EXTENSION_FUNCTION("autotestPrivate.logout", AUTOTESTPRIVATE_LOGOUT)
19 19
20 private: 20 private:
21 virtual ~AutotestPrivateLogoutFunction() {} 21 virtual ~AutotestPrivateLogoutFunction() {}
22 virtual bool RunImpl() OVERRIDE; 22 virtual bool RunImpl() OVERRIDE;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 private: 81 private:
82 virtual ~AutotestPrivateSimulateAsanMemoryBugFunction() {} 82 virtual ~AutotestPrivateSimulateAsanMemoryBugFunction() {}
83 virtual bool RunImpl() OVERRIDE; 83 virtual bool RunImpl() OVERRIDE;
84 }; 84 };
85 85
86 // Don't kill the browser when we're in a browser test. 86 // Don't kill the browser when we're in a browser test.
87 void SetAutotestPrivateTest(); 87 void SetAutotestPrivateTest();
88 88
89 // The profile-keyed service that manages the autotestPrivate extension API. 89 // The profile-keyed service that manages the autotestPrivate extension API.
90 class AutotestPrivateAPI : public ProfileKeyedAPI { 90 class AutotestPrivateAPI : public BrowserContextKeyedAPI {
91 public: 91 public:
92 static ProfileKeyedAPIFactory<AutotestPrivateAPI>* GetFactoryInstance(); 92 static BrowserContextKeyedAPIFactory<AutotestPrivateAPI>*
93 GetFactoryInstance();
93 94
94 // TODO(achuith): Replace these with a mock object for system calls. 95 // TODO(achuith): Replace these with a mock object for system calls.
95 bool test_mode() const { return test_mode_; } 96 bool test_mode() const { return test_mode_; }
96 void set_test_mode(bool test_mode) { test_mode_ = test_mode; } 97 void set_test_mode(bool test_mode) { test_mode_ = test_mode; }
97 98
98 private: 99 private:
99 friend class ProfileKeyedAPIFactory<AutotestPrivateAPI>; 100 friend class BrowserContextKeyedAPIFactory<AutotestPrivateAPI>;
100 101
101 AutotestPrivateAPI(); 102 AutotestPrivateAPI();
102 virtual ~AutotestPrivateAPI(); 103 virtual ~AutotestPrivateAPI();
103 104
104 // ProfileKeyedAPI implementation. 105 // BrowserContextKeyedAPI implementation.
105 static const char* service_name() { return "AutotestPrivateAPI"; } 106 static const char* service_name() { return "AutotestPrivateAPI"; }
106 static const bool kServiceIsNULLWhileTesting = true; 107 static const bool kServiceIsNULLWhileTesting = true;
107 static const bool kServiceRedirectedInIncognito = true; 108 static const bool kServiceRedirectedInIncognito = true;
108 109
109 bool test_mode_; // true for ExtensionApiTest.AutotestPrivate browser test. 110 bool test_mode_; // true for ExtensionApiTest.AutotestPrivate browser test.
110 }; 111 };
111 112
112 template <> 113 template <>
113 BrowserContextKeyedService* 114 BrowserContextKeyedService*
114 ProfileKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor( 115 BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor(
115 content::BrowserContext* context) const; 116 content::BrowserContext* context) const;
116 117
117 } // namespace extensions 118 } // namespace extensions
118 119
119 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H _ 120 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698