| 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 <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 void CookiesEventRouter::DispatchEvent( | 187 void CookiesEventRouter::DispatchEvent( |
| 188 content::BrowserContext* context, | 188 content::BrowserContext* context, |
| 189 events::HistogramValue histogram_value, | 189 events::HistogramValue histogram_value, |
| 190 const std::string& event_name, | 190 const std::string& event_name, |
| 191 std::unique_ptr<base::ListValue> event_args, | 191 std::unique_ptr<base::ListValue> event_args, |
| 192 GURL& cookie_domain) { | 192 GURL& cookie_domain) { |
| 193 EventRouter* router = context ? EventRouter::Get(context) : NULL; | 193 EventRouter* router = context ? EventRouter::Get(context) : NULL; |
| 194 if (!router) | 194 if (!router) |
| 195 return; | 195 return; |
| 196 std::unique_ptr<Event> event( | 196 auto event = base::MakeUnique<Event>(histogram_value, event_name, |
| 197 new Event(histogram_value, event_name, std::move(event_args))); | 197 std::move(event_args), context); |
| 198 event->restrict_to_browser_context = context; | |
| 199 event->event_url = cookie_domain; | 198 event->event_url = cookie_domain; |
| 200 router->BroadcastEvent(std::move(event)); | 199 router->BroadcastEvent(std::move(event)); |
| 201 } | 200 } |
| 202 | 201 |
| 203 CookiesGetFunction::CookiesGetFunction() { | 202 CookiesGetFunction::CookiesGetFunction() { |
| 204 } | 203 } |
| 205 | 204 |
| 206 CookiesGetFunction::~CookiesGetFunction() { | 205 CookiesGetFunction::~CookiesGetFunction() { |
| 207 } | 206 } |
| 208 | 207 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { | 587 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { |
| 589 return g_factory.Pointer(); | 588 return g_factory.Pointer(); |
| 590 } | 589 } |
| 591 | 590 |
| 592 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) { | 591 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 593 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); | 592 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); |
| 594 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 593 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 595 } | 594 } |
| 596 | 595 |
| 597 } // namespace extensions | 596 } // namespace extensions |
| OLD | NEW |