| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/extensions/event_router.h" | 17 #include "chrome/browser/extensions/event_router.h" |
| 18 #include "chrome/browser/extensions/extension_system.h" |
| 18 #include "chrome/browser/history/history.h" | 19 #include "chrome/browser/history/history.h" |
| 19 #include "chrome/browser/history/history_service_factory.h" | 20 #include "chrome/browser/history/history_service_factory.h" |
| 20 #include "chrome/browser/history/history_types.h" | 21 #include "chrome/browser/history/history_types.h" |
| 21 #include "chrome/browser/history/visit_filter.h" | 22 #include "chrome/browser/history/visit_filter.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
| 24 #include "chrome/common/extensions/api/experimental_history.h" | 25 #include "chrome/common/extensions/api/experimental_history.h" |
| 25 #include "content/public/browser/notification_details.h" | 26 #include "content/public/browser/notification_details.h" |
| 26 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
| 27 | 28 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 removed.urls.reset(urls); | 181 removed.urls.reset(urls); |
| 181 | 182 |
| 182 scoped_ptr<ListValue> args = OnVisitRemoved::Create(removed); | 183 scoped_ptr<ListValue> args = OnVisitRemoved::Create(removed); |
| 183 DispatchEvent(profile, kOnVisitRemoved, args.Pass()); | 184 DispatchEvent(profile, kOnVisitRemoved, args.Pass()); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void HistoryExtensionEventRouter::DispatchEvent( | 187 void HistoryExtensionEventRouter::DispatchEvent( |
| 187 Profile* profile, | 188 Profile* profile, |
| 188 const char* event_name, | 189 const char* event_name, |
| 189 scoped_ptr<ListValue> event_args) { | 190 scoped_ptr<ListValue> event_args) { |
| 190 if (profile && profile->GetExtensionEventRouter()) { | 191 if (profile && extensions::ExtensionSystem::Get(profile)->event_router()) { |
| 191 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 192 extensions::ExtensionSystem::Get(profile)->event_router()-> |
| 192 event_name, event_args.Pass(), profile, GURL(), | 193 DispatchEventToRenderers(event_name, event_args.Pass(), profile, GURL(), |
| 193 extensions::EventFilteringInfo()); | 194 extensions::EventFilteringInfo()); |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 | 197 |
| 197 void HistoryFunction::Run() { | 198 void HistoryFunction::Run() { |
| 198 if (!RunImpl()) { | 199 if (!RunImpl()) { |
| 199 SendResponse(false); | 200 SendResponse(false); |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 | 203 |
| 203 bool HistoryFunction::ValidateUrl(const std::string& url_string, GURL* url) { | 204 bool HistoryFunction::ValidateUrl(const std::string& url_string, GURL* url) { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 &cancelable_consumer_, | 441 &cancelable_consumer_, |
| 441 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, | 442 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, |
| 442 base::Unretained(this))); | 443 base::Unretained(this))); |
| 443 | 444 |
| 444 return true; | 445 return true; |
| 445 } | 446 } |
| 446 | 447 |
| 447 void DeleteAllHistoryFunction::DeleteComplete() { | 448 void DeleteAllHistoryFunction::DeleteComplete() { |
| 448 SendAsyncResponse(); | 449 SendAsyncResponse(); |
| 449 } | 450 } |
| OLD | NEW |