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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 void ExtensionCookiesEventRouter::DispatchEvent( | 126 void ExtensionCookiesEventRouter::DispatchEvent( |
127 Profile* profile, | 127 Profile* profile, |
128 const std::string& event_name, | 128 const std::string& event_name, |
129 scoped_ptr<ListValue> event_args, | 129 scoped_ptr<ListValue> event_args, |
130 GURL& cookie_domain) { | 130 GURL& cookie_domain) { |
131 EventRouter* router = profile ? | 131 EventRouter* router = profile ? |
132 extensions::ExtensionSystem::Get(profile)->event_router() : NULL; | 132 extensions::ExtensionSystem::Get(profile)->event_router() : NULL; |
133 if (!router) | 133 if (!router) |
134 return; | 134 return; |
135 router->DispatchEventToRenderers(event_name, event_args.Pass(), profile, | 135 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); |
136 cookie_domain); | 136 event->restrict_to_profile = profile; |
| 137 event->event_url = cookie_domain; |
| 138 router->BroadcastEvent(event.Pass()); |
137 } | 139 } |
138 | 140 |
139 bool CookiesFunction::ParseUrl(const std::string& url_string, GURL* url, | 141 bool CookiesFunction::ParseUrl(const std::string& url_string, GURL* url, |
140 bool check_host_permissions) { | 142 bool check_host_permissions) { |
141 *url = GURL(url_string); | 143 *url = GURL(url_string); |
142 if (!url->is_valid()) { | 144 if (!url->is_valid()) { |
143 error_ = ErrorUtils::FormatErrorMessage( | 145 error_ = ErrorUtils::FormatErrorMessage( |
144 keys::kInvalidUrlError, url_string); | 146 keys::kInvalidUrlError, url_string); |
145 return false; | 147 return false; |
146 } | 148 } |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 536 } |
535 results_ = GetAllCookieStores::Results::Create(cookie_stores); | 537 results_ = GetAllCookieStores::Results::Create(cookie_stores); |
536 return true; | 538 return true; |
537 } | 539 } |
538 | 540 |
539 void GetAllCookieStoresFunction::Run() { | 541 void GetAllCookieStoresFunction::Run() { |
540 SendResponse(RunImpl()); | 542 SendResponse(RunImpl()); |
541 } | 543 } |
542 | 544 |
543 } // namespace extensions | 545 } // namespace extensions |
OLD | NEW |