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 #include "chrome/browser/history/history_extension_api.h" | 5 #include "chrome/browser/history/history_extension_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 scoped_ptr<ListValue> args = OnVisitRemoved::Create(removed); | 184 scoped_ptr<ListValue> args = OnVisitRemoved::Create(removed); |
185 DispatchEvent(profile, kOnVisitRemoved, args.Pass()); | 185 DispatchEvent(profile, kOnVisitRemoved, args.Pass()); |
186 } | 186 } |
187 | 187 |
188 void HistoryExtensionEventRouter::DispatchEvent( | 188 void HistoryExtensionEventRouter::DispatchEvent( |
189 Profile* profile, | 189 Profile* profile, |
190 const char* event_name, | 190 const char* event_name, |
191 scoped_ptr<ListValue> event_args) { | 191 scoped_ptr<ListValue> event_args) { |
192 if (profile && extensions::ExtensionSystem::Get(profile)->event_router()) { | 192 if (profile && extensions::ExtensionSystem::Get(profile)->event_router()) { |
| 193 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 194 event_name, event_args.Pass())); |
| 195 event->restrict_to_profile = profile; |
193 extensions::ExtensionSystem::Get(profile)->event_router()-> | 196 extensions::ExtensionSystem::Get(profile)->event_router()-> |
194 DispatchEventToRenderers(event_name, event_args.Pass(), profile, GURL(), | 197 BroadcastEvent(event.Pass()); |
195 extensions::EventFilteringInfo()); | |
196 } | 198 } |
197 } | 199 } |
198 | 200 |
199 void HistoryFunction::Run() { | 201 void HistoryFunction::Run() { |
200 if (!RunImpl()) { | 202 if (!RunImpl()) { |
201 SendResponse(false); | 203 SendResponse(false); |
202 } | 204 } |
203 } | 205 } |
204 | 206 |
205 bool HistoryFunction::ValidateUrl(const std::string& url_string, GURL* url) { | 207 bool HistoryFunction::ValidateUrl(const std::string& url_string, GURL* url) { |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, | 444 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, |
443 base::Unretained(this)), | 445 base::Unretained(this)), |
444 &task_tracker_); | 446 &task_tracker_); |
445 | 447 |
446 return true; | 448 return true; |
447 } | 449 } |
448 | 450 |
449 void DeleteAllHistoryFunction::DeleteComplete() { | 451 void DeleteAllHistoryFunction::DeleteComplete() { |
450 SendAsyncResponse(); | 452 SendAsyncResponse(); |
451 } | 453 } |
OLD | NEW |