| 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 // Implements the Chrome Extensions Cookies API. | 5 // Implements the Chrome Extensions Cookies API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/cookies/cookies_api.h" | 7 #include "chrome/browser/extensions/api/cookies/cookies_api.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 cookie_domain); | 186 cookie_domain); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void CookiesEventRouter::DispatchEvent(content::BrowserContext* context, | 189 void CookiesEventRouter::DispatchEvent(content::BrowserContext* context, |
| 190 const std::string& event_name, | 190 const std::string& event_name, |
| 191 scoped_ptr<base::ListValue> event_args, | 191 scoped_ptr<base::ListValue> event_args, |
| 192 GURL& cookie_domain) { | 192 GURL& cookie_domain) { |
| 193 EventRouter* router = context ? extensions::EventRouter::Get(context) : NULL; | 193 EventRouter* router = context ? extensions::EventRouter::Get(context) : NULL; |
| 194 if (!router) | 194 if (!router) |
| 195 return; | 195 return; |
| 196 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); | 196 scoped_ptr<Event> event( |
| 197 new Event(events::UNKNOWN, event_name, event_args.Pass())); |
| 197 event->restrict_to_browser_context = context; | 198 event->restrict_to_browser_context = context; |
| 198 event->event_url = cookie_domain; | 199 event->event_url = cookie_domain; |
| 199 router->BroadcastEvent(event.Pass()); | 200 router->BroadcastEvent(event.Pass()); |
| 200 } | 201 } |
| 201 | 202 |
| 202 CookiesGetFunction::CookiesGetFunction() { | 203 CookiesGetFunction::CookiesGetFunction() { |
| 203 } | 204 } |
| 204 | 205 |
| 205 CookiesGetFunction::~CookiesGetFunction() { | 206 CookiesGetFunction::~CookiesGetFunction() { |
| 206 } | 207 } |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 return g_factory.Pointer(); | 583 return g_factory.Pointer(); |
| 583 } | 584 } |
| 584 | 585 |
| 585 void CookiesAPI::OnListenerAdded( | 586 void CookiesAPI::OnListenerAdded( |
| 586 const extensions::EventListenerInfo& details) { | 587 const extensions::EventListenerInfo& details) { |
| 587 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); | 588 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); |
| 588 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 589 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 589 } | 590 } |
| 590 | 591 |
| 591 } // namespace extensions | 592 } // namespace extensions |
| OLD | NEW |