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

Side by Side Diff: chrome/browser/extensions/api/cookies/cookies_api.h

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 // Defines the Chrome Extensions Cookies API functions for accessing internet 5 // Defines the Chrome Extensions Cookies API functions for accessing internet
6 // cookies, as specified in the extension API JSON. 6 // cookies, as specified in the extension API JSON.
7 7
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_API_H_ 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_API_H_
9 #define CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_API_H_ 9 #define CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_API_H_
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
17 #include "chrome/browser/extensions/chrome_extension_function.h" 16 #include "chrome/browser/extensions/chrome_extension_function.h"
18 #include "chrome/browser/net/chrome_cookie_notification_details.h" 17 #include "chrome/browser/net/chrome_cookie_notification_details.h"
19 #include "chrome/common/extensions/api/cookies.h" 18 #include "chrome/common/extensions/api/cookies.h"
20 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
21 #include "extensions/browser/browser_context_keyed_api_factory.h"
22 #include "extensions/browser/event_router.h" 22 #include "extensions/browser/event_router.h"
23 #include "net/cookies/canonical_cookie.h" 23 #include "net/cookies/canonical_cookie.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 namespace net { 26 namespace net {
27 class URLRequestContextGetter; 27 class URLRequestContextGetter;
28 } 28 }
29 29
30 namespace extensions { 30 namespace extensions {
31 31
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 protected: 187 protected:
188 virtual ~CookiesGetAllCookieStoresFunction() {} 188 virtual ~CookiesGetAllCookieStoresFunction() {}
189 189
190 // ExtensionFunction: 190 // ExtensionFunction:
191 // CookiesGetAllCookieStoresFunction is sync. 191 // CookiesGetAllCookieStoresFunction is sync.
192 virtual void Run() OVERRIDE; 192 virtual void Run() OVERRIDE;
193 virtual bool RunImpl() OVERRIDE; 193 virtual bool RunImpl() OVERRIDE;
194 }; 194 };
195 195
196 class CookiesAPI : public ProfileKeyedAPI, 196 class CookiesAPI : public BrowserContextKeyedAPI,
197 public extensions::EventRouter::Observer { 197 public extensions::EventRouter::Observer {
198 public: 198 public:
199 explicit CookiesAPI(content::BrowserContext* context); 199 explicit CookiesAPI(content::BrowserContext* context);
200 virtual ~CookiesAPI(); 200 virtual ~CookiesAPI();
201 201
202 // BrowserContextKeyedService implementation. 202 // BrowserContextKeyedService implementation.
203 virtual void Shutdown() OVERRIDE; 203 virtual void Shutdown() OVERRIDE;
204 204
205 // ProfileKeyedAPI implementation. 205 // BrowserContextKeyedAPI implementation.
206 static ProfileKeyedAPIFactory<CookiesAPI>* GetFactoryInstance(); 206 static BrowserContextKeyedAPIFactory<CookiesAPI>* GetFactoryInstance();
207 207
208 // EventRouter::Observer implementation. 208 // EventRouter::Observer implementation.
209 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) 209 virtual void OnListenerAdded(const extensions::EventListenerInfo& details)
210 OVERRIDE; 210 OVERRIDE;
211 211
212 private: 212 private:
213 friend class ProfileKeyedAPIFactory<CookiesAPI>; 213 friend class BrowserContextKeyedAPIFactory<CookiesAPI>;
214 214
215 content::BrowserContext* browser_context_; 215 content::BrowserContext* browser_context_;
216 216
217 // ProfileKeyedAPI implementation. 217 // BrowserContextKeyedAPI implementation.
218 static const char* service_name() { 218 static const char* service_name() {
219 return "CookiesAPI"; 219 return "CookiesAPI";
220 } 220 }
221 static const bool kServiceIsNULLWhileTesting = true; 221 static const bool kServiceIsNULLWhileTesting = true;
222 222
223 // Created lazily upon OnListenerAdded. 223 // Created lazily upon OnListenerAdded.
224 scoped_ptr<CookiesEventRouter> cookies_event_router_; 224 scoped_ptr<CookiesEventRouter> cookies_event_router_;
225 225
226 DISALLOW_COPY_AND_ASSIGN(CookiesAPI); 226 DISALLOW_COPY_AND_ASSIGN(CookiesAPI);
227 }; 227 };
228 228
229 } // namespace extensions 229 } // namespace extensions
230 230
231 #endif // CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_API_H_ 231 #endif // CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698