| OLD | NEW |
| 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace net { | 26 namespace net { |
| 27 class URLRequestContextGetter; | 27 class URLRequestContextGetter; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace extensions { | 30 namespace extensions { |
| 31 | 31 |
| 32 // Observes CookieMonster notifications and routes them as events to the | 32 // Observes CookieMonster notifications and routes them as events to the |
| 33 // extension system. | 33 // extension system. |
| 34 class CookiesEventRouter : public content::NotificationObserver { | 34 class CookiesEventRouter : public content::NotificationObserver { |
| 35 public: | 35 public: |
| 36 explicit CookiesEventRouter(Profile* profile); | 36 explicit CookiesEventRouter(content::BrowserContext* context); |
| 37 virtual ~CookiesEventRouter(); | 37 virtual ~CookiesEventRouter(); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // content::NotificationObserver implementation. | 40 // content::NotificationObserver implementation. |
| 41 virtual void Observe(int type, | 41 virtual void Observe(int type, |
| 42 const content::NotificationSource& source, | 42 const content::NotificationSource& source, |
| 43 const content::NotificationDetails& details) OVERRIDE; | 43 const content::NotificationDetails& details) OVERRIDE; |
| 44 | 44 |
| 45 // Handler for the COOKIE_CHANGED event. The method takes the details of such | 45 // Handler for the COOKIE_CHANGED event. The method takes the details of such |
| 46 // an event and constructs a suitable JSON formatted extension event from it. | 46 // an event and constructs a suitable JSON formatted extension event from it. |
| 47 void CookieChanged(Profile* profile, ChromeCookieDetails* details); | 47 void CookieChanged(Profile* profile, ChromeCookieDetails* details); |
| 48 | 48 |
| 49 // This method dispatches events to the extension message service. | 49 // This method dispatches events to the extension message service. |
| 50 void DispatchEvent(Profile* context, | 50 void DispatchEvent(content::BrowserContext* context, |
| 51 const std::string& event_name, | 51 const std::string& event_name, |
| 52 scoped_ptr<base::ListValue> event_args, | 52 scoped_ptr<base::ListValue> event_args, |
| 53 GURL& cookie_domain); | 53 GURL& cookie_domain); |
| 54 | 54 |
| 55 // Used for tracking registrations to CookieMonster notifications. | 55 // Used for tracking registrations to CookieMonster notifications. |
| 56 content::NotificationRegistrar registrar_; | 56 content::NotificationRegistrar registrar_; |
| 57 | 57 |
| 58 Profile* profile_; | 58 Profile* profile_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(CookiesEventRouter); | 60 DISALLOW_COPY_AND_ASSIGN(CookiesEventRouter); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_ |
| OLD | NEW |