| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/activity_log_private/activity_log_privat
e_api.h" | 5 #include "chrome/browser/extensions/api/activity_log_private/activity_log_privat
e_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/extensions/event_router_forwarder.h" | 12 #include "chrome/browser/extensions/event_router_forwarder.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/extensions/api/activity_log_private.h" | 15 #include "chrome/common/extensions/api/activity_log_private.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
| 18 #include "extensions/browser/extension_system_provider.h" |
| 19 #include "extensions/browser/extensions_browser_client.h" |
| 18 #include "extensions/common/features/feature.h" | 20 #include "extensions/common/features/feature.h" |
| 19 #include "extensions/common/features/feature_provider.h" | 21 #include "extensions/common/features/feature_provider.h" |
| 20 | 22 |
| 21 namespace extensions { | 23 namespace extensions { |
| 22 | 24 |
| 23 namespace activity_log_private = api::activity_log_private; | 25 namespace activity_log_private = api::activity_log_private; |
| 24 | 26 |
| 25 using api::activity_log_private::ActivityResultSet; | 27 using api::activity_log_private::ActivityResultSet; |
| 26 using api::activity_log_private::ExtensionActivity; | 28 using api::activity_log_private::ExtensionActivity; |
| 27 using api::activity_log_private::Filter; | 29 using api::activity_log_private::Filter; |
| 28 | 30 |
| 29 static base::LazyInstance<ProfileKeyedAPIFactory<ActivityLogAPI> > | 31 static base::LazyInstance<ProfileKeyedAPIFactory<ActivityLogAPI> > |
| 30 g_factory = LAZY_INSTANCE_INITIALIZER; | 32 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 31 | 33 |
| 32 // static | 34 // static |
| 33 ProfileKeyedAPIFactory<ActivityLogAPI>* ActivityLogAPI::GetFactoryInstance() { | 35 ProfileKeyedAPIFactory<ActivityLogAPI>* ActivityLogAPI::GetFactoryInstance() { |
| 34 return g_factory.Pointer(); | 36 return g_factory.Pointer(); |
| 35 } | 37 } |
| 36 | 38 |
| 37 template<> | 39 template<> |
| 38 void ProfileKeyedAPIFactory<ActivityLogAPI>::DeclareFactoryDependencies() { | 40 void ProfileKeyedAPIFactory<ActivityLogAPI>::DeclareFactoryDependencies() { |
| 39 DependsOn(ExtensionSystemFactory::GetInstance()); | 41 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 40 DependsOn(ActivityLogFactory::GetInstance()); | 42 DependsOn(ActivityLogFactory::GetInstance()); |
| 41 } | 43 } |
| 42 | 44 |
| 43 ActivityLogAPI::ActivityLogAPI(Profile* profile) | 45 ActivityLogAPI::ActivityLogAPI(Profile* profile) |
| 44 : profile_(profile), | 46 : profile_(profile), |
| 45 initialized_(false) { | 47 initialized_(false) { |
| 46 if (!ExtensionSystem::Get(profile_)->event_router()) { // Check for testing. | 48 if (!ExtensionSystem::Get(profile_)->event_router()) { // Check for testing. |
| 47 DVLOG(1) << "ExtensionSystem event_router does not exist."; | 49 DVLOG(1) << "ExtensionSystem event_router does not exist."; |
| 48 return; | 50 return; |
| 49 } | 51 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 gurls.push_back(GURL(*it)); | 197 gurls.push_back(GURL(*it)); |
| 196 } | 198 } |
| 197 | 199 |
| 198 ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile()); | 200 ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile()); |
| 199 DCHECK(activity_log); | 201 DCHECK(activity_log); |
| 200 activity_log->RemoveURLs(gurls); | 202 activity_log->RemoveURLs(gurls); |
| 201 return true; | 203 return true; |
| 202 } | 204 } |
| 203 | 205 |
| 204 } // namespace extensions | 206 } // namespace extensions |
| OLD | NEW |