| 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/extensions/api/history/history_api.h" | 5 #include "chrome/browser/extensions/api/history/history_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/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/profiler/scoped_profile.h" | |
| 17 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/task/cancelable_task_tracker.h" | 18 #include "base/task/cancelable_task_tracker.h" |
| 20 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 21 #include "base/values.h" | 20 #include "base/values.h" |
| 22 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
| 23 #include "chrome/browser/extensions/activity_log/activity_log.h" | 22 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 24 #include "chrome/browser/history/history_service.h" | 23 #include "chrome/browser/history/history_service.h" |
| 25 #include "chrome/browser/history/history_service_factory.h" | 24 #include "chrome/browser/history/history_service_factory.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 return g_factory.Pointer(); | 215 return g_factory.Pointer(); |
| 217 } | 216 } |
| 218 | 217 |
| 219 template <> | 218 template <> |
| 220 void BrowserContextKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies() { | 219 void BrowserContextKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies() { |
| 221 DependsOn(ActivityLog::GetFactoryInstance()); | 220 DependsOn(ActivityLog::GetFactoryInstance()); |
| 222 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 221 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 223 } | 222 } |
| 224 | 223 |
| 225 void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) { | 224 void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 226 // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. | |
| 227 tracked_objects::ScopedProfile tracking_profile( | |
| 228 FROM_HERE_WITH_EXPLICIT_FUNCTION("HistoryAPI::OnListenerAdded")); | |
| 229 | |
| 230 Profile* profile = Profile::FromBrowserContext(browser_context_); | 225 Profile* profile = Profile::FromBrowserContext(browser_context_); |
| 231 history_event_router_.reset(new HistoryEventRouter( | 226 history_event_router_.reset(new HistoryEventRouter( |
| 232 profile, | 227 profile, |
| 233 HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS))); | 228 HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS))); |
| 234 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 229 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 235 } | 230 } |
| 236 | 231 |
| 237 bool HistoryFunction::ValidateUrl(const std::string& url_string, GURL* url) { | 232 bool HistoryFunction::ValidateUrl(const std::string& url_string, GURL* url) { |
| 238 GURL temp_url(url_string); | 233 GURL temp_url(url_string); |
| 239 if (!temp_url.is_valid()) { | 234 if (!temp_url.is_valid()) { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 467 } |
| 473 | 468 |
| 474 return true; | 469 return true; |
| 475 } | 470 } |
| 476 | 471 |
| 477 void HistoryDeleteAllFunction::DeleteComplete() { | 472 void HistoryDeleteAllFunction::DeleteComplete() { |
| 478 SendAsyncResponse(); | 473 SendAsyncResponse(); |
| 479 } | 474 } |
| 480 | 475 |
| 481 } // namespace extensions | 476 } // namespace extensions |
| OLD | NEW |