summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/app_restore_service_browsertest.cc2
-rw-r--r--apps/app_shim/extension_app_shim_handler_mac.cc4
-rw-r--r--apps/saved_files_service.cc2
-rw-r--r--chrome/browser/chromeos/app_mode/startup_app_launcher.cc4
-rw-r--r--chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc4
-rw-r--r--chrome/browser/extensions/activity_log/activity_database_unittest.cc2
-rw-r--r--chrome/browser/extensions/activity_log/activity_log_browsertest.cc1
-rw-r--r--chrome/browser/extensions/api/api_function.cc2
-rw-r--r--chrome/browser/extensions/api/api_resource.h4
-rw-r--r--chrome/browser/extensions/api/api_resource_manager.h95
-rw-r--r--chrome/browser/extensions/api/api_resource_manager_unittest.cc5
-rw-r--r--chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc1
-rw-r--r--chrome/browser/extensions/api/debugger/debugger_api.cc4
-rw-r--r--chrome/browser/extensions/api/declarative_content/content_rules_registry.cc3
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc4
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.cc2
-rw-r--r--chrome/browser/extensions/api/dial/dial_api.cc3
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api.cc1
-rw-r--r--chrome/browser/extensions/api/file_system/file_system_api.cc6
-rw-r--r--chrome/browser/extensions/api/file_system/file_system_apitest.cc2
-rw-r--r--chrome/browser/extensions/api/identity/identity_api.cc1
-rw-r--r--chrome/browser/extensions/api/identity/web_auth_flow.cc1
-rw-r--r--chrome/browser/extensions/api/idle/idle_manager.cc2
-rw-r--r--chrome/browser/extensions/api/input_ime/input_ime_api.cc3
-rw-r--r--chrome/browser/extensions/api/location/location_manager.cc10
-rw-r--r--chrome/browser/extensions/api/management/management_api_browsertest.cc1
-rw-r--r--chrome/browser/extensions/api/messaging/native_message_port.cc1
-rw-r--r--chrome/browser/extensions/api/runtime/runtime_api.cc2
-rw-r--r--chrome/browser/extensions/api/serial/serial_api.cc5
-rw-r--r--chrome/browser/extensions/api/serial/serial_connection.cc13
-rw-r--r--chrome/browser/extensions/api/serial/serial_connection.h6
-rw-r--r--chrome/browser/extensions/api/socket/socket.cc12
-rw-r--r--chrome/browser/extensions/api/socket/socket.h6
-rw-r--r--chrome/browser/extensions/api/socket/socket_api.cc2
-rw-r--r--chrome/browser/extensions/api/socket/socket_api.h2
-rw-r--r--chrome/browser/extensions/api/socket/socket_api_unittest.cc37
-rw-r--r--chrome/browser/extensions/api/spellcheck/spellcheck_api.cc4
-rw-r--r--chrome/browser/extensions/api/storage/managed_value_store_cache.cc2
-rw-r--r--chrome/browser/extensions/api/streams_private/streams_private_api.cc3
-rw-r--r--chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc3
-rw-r--r--chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc2
-rw-r--r--chrome/browser/extensions/api/usb/usb_api.cc3
-rw-r--r--chrome/browser/extensions/api/usb/usb_device_resource.cc11
-rw-r--r--chrome/browser/extensions/api/usb/usb_device_resource.h6
-rw-r--r--chrome/browser/extensions/event_router_forwarder.cc1
-rw-r--r--chrome/browser/extensions/extension_blacklist_browsertest.cc1
-rw-r--r--chrome/browser/extensions/extension_disabled_ui_browsertest.cc5
-rw-r--r--chrome/browser/extensions/extension_functional_browsertest.cc2
-rw-r--r--chrome/browser/extensions/extension_system.cc20
-rw-r--r--chrome/browser/extensions/extension_system.h27
-rw-r--r--chrome/browser/extensions/test_extension_system.cc25
-rw-r--r--chrome/browser/extensions/test_extension_system.h6
-rw-r--r--chrome/browser/extensions/web_view_interactive_browsertest.cc1
-rw-r--r--chrome/browser/managed_mode/managed_user_service.cc2
-rw-r--r--chrome/browser/media_galleries/media_file_system_registry_unittest.cc2
-rw-r--r--chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc9
-rw-r--r--chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc6
-rw-r--r--chrome/browser/task_manager/extension_process_resource_provider.cc3
-rw-r--r--chrome/browser/themes/theme_syncable_service_unittest.cc4
-rw-r--r--chrome/browser/ui/app_list/search/app_search_provider.cc3
-rw-r--r--chrome/browser/ui/ash/app_sync_ui_state.cc2
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc2
-rw-r--r--chrome/browser/ui/browser_browsertest.cc1
-rw-r--r--chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc2
-rw-r--r--chrome/browser/ui/views/browser_actions_container_browsertest.cc1
65 files changed, 281 insertions, 133 deletions
diff --git a/apps/app_restore_service_browsertest.cc b/apps/app_restore_service_browsertest.cc
index cf832fe..a1e36bb 100644
--- a/apps/app_restore_service_browsertest.cc
+++ b/apps/app_restore_service_browsertest.cc
@@ -9,7 +9,9 @@
#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/platform_app_browsertest_util.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/test/test_utils.h"
using extensions::Extension;
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.cc
index 9e97735..396184b 100644
--- a/apps/app_shim/extension_app_shim_handler_mac.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac.cc
@@ -16,6 +16,10 @@
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/browser/ui/web_applications/web_app_ui.h"
#include "chrome/browser/web_applications/web_app_mac.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
#include "ui/base/cocoa/focus_window_set.h"
namespace apps {
diff --git a/apps/saved_files_service.cc b/apps/saved_files_service.cc
index 13767b7..2ed3919 100644
--- a/apps/saved_files_service.cc
+++ b/apps/saved_files_service.cc
@@ -14,8 +14,10 @@
#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/permissions/api_permission.h"
#include "chrome/common/extensions/permissions/permission_set.h"
+#include "content/public/browser/notification_service.h"
namespace apps {
diff --git a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
index 9289ef0..0dd80fe 100644
--- a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
+++ b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
@@ -22,11 +22,15 @@
#include "chrome/browser/signin/token_service.h"
#include "chrome/browser/signin/token_service_factory.h"
#include "chrome/browser/ui/extensions/application_launch.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
#include "google_apis/gaia/gaia_auth_consumer.h"
#include "google_apis/gaia/gaia_constants.h"
diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
index 1e10adb..913844d 100644
--- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
+++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
@@ -139,8 +139,8 @@ void ComponentExtensionIMEManagerImpl::InitializeAsync(
std::vector<ComponentExtensionIME>* component_extension_ime_list
= new std::vector<ComponentExtensionIME>;
- BrowserThread::PostTaskAndReply(
- BrowserThread::FILE,
+ content::BrowserThread::PostTaskAndReply(
+ content::BrowserThread::FILE,
FROM_HERE,
base::Bind(&ComponentExtensionIMEManagerImpl::ReadComponentExtensionsInfo,
base::Unretained(component_extension_ime_list)),
diff --git a/chrome/browser/extensions/activity_log/activity_database_unittest.cc b/chrome/browser/extensions/activity_log/activity_database_unittest.cc
index a50238a..dae4f72 100644
--- a/chrome/browser/extensions/activity_log/activity_database_unittest.cc
+++ b/chrome/browser/extensions/activity_log/activity_database_unittest.cc
@@ -35,6 +35,8 @@
#include "chromeos/chromeos_switches.h"
#endif
+using content::BrowserThread;
+
namespace extensions {
class ActivityDatabaseTest : public ChromeRenderViewHostTestHarness {
diff --git a/chrome/browser/extensions/activity_log/activity_log_browsertest.cc b/chrome/browser/extensions/activity_log/activity_log_browsertest.cc
index fa22362..ad2fa09 100644
--- a/chrome/browser/extensions/activity_log/activity_log_browsertest.cc
+++ b/chrome/browser/extensions/activity_log/activity_log_browsertest.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/test/browser_test_utils.h"
#include "net/dns/mock_host_resolver.h"
diff --git a/chrome/browser/extensions/api/api_function.cc b/chrome/browser/extensions/api/api_function.cc
index 53ff107..f3c2d9f 100644
--- a/chrome/browser/extensions/api/api_function.cc
+++ b/chrome/browser/extensions/api/api_function.cc
@@ -64,7 +64,7 @@ void AsyncApiFunction::AsyncWorkCompleted() {
void AsyncApiFunction::WorkOnWorkThread() {
DCHECK(BrowserThread::CurrentlyOn(work_thread_id_));
- DCHECK(work_thread_id_ != BrowserThread::UI) <<
+ DLOG_IF(ERROR, (work_thread_id_ == BrowserThread::UI)) <<
"You have specified that AsyncApiFunction::Work() should happen on "
"the UI thread. This nullifies the point of this class. Either "
"specify a different thread or derive from a different class.";
diff --git a/chrome/browser/extensions/api/api_resource.h b/chrome/browser/extensions/api/api_resource.h
index 13361dc..4a21083 100644
--- a/chrome/browser/extensions/api/api_resource.h
+++ b/chrome/browser/extensions/api/api_resource.h
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "chrome/common/extensions/extension.h"
+#include "content/public/browser/browser_thread.h"
namespace extensions {
@@ -22,6 +23,9 @@ class ApiResource {
return owner_extension_id_;
}
+ static const content::BrowserThread::ID kThreadId =
+ content::BrowserThread::IO;
+
protected:
explicit ApiResource(const std::string& owner_extension_id);
diff --git a/chrome/browser/extensions/api/api_resource_manager.h b/chrome/browser/extensions/api/api_resource_manager.h
index bfa923a..814fc9b 100644
--- a/chrome/browser/extensions/api/api_resource_manager.h
+++ b/chrome/browser/extensions/api/api_resource_manager.h
@@ -7,8 +7,10 @@
#include <map>
+#include "base/lazy_instance.h"
#include "base/memory/linked_ptr.h"
#include "base/threading/non_thread_safe.h"
+#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
@@ -17,33 +19,85 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
-using content::BrowserThread;
-
namespace extensions {
// An ApiResourceManager manages the lifetime of a set of resources that
// ApiFunctions use. Examples are sockets or USB connections.
+//
+// Users of this class should define kThreadId to be the thread that
+// ApiResourceManager to works on. The default is defined in ApiResource.
+// The user must also define a static const char* service_name() that returns
+// the name of the service, and in order for ApiResourceManager to use
+// service_name() friend this class.
+//
+// In the cc file the user must define a GetFactoryInstance() and manage their
+// own instances (typically using LazyInstance or Singleton).
+//
+// E.g.:
+//
+// class Resource {
+// public:
+// static const BrowserThread::ID kThreadId = BrowserThread::FILE;
+// private:
+// friend class ApiResourceManager<Resource>;
+// static const char* service_name() {
+// return "ResourceManager";
+// }
+// };
+//
+// In the cc file:
+//
+// static base::LazyInstance<ProfileKeyedAPIFactory<
+// ApiResourceManager<Resource> > >
+// g_factory = LAZY_INSTANCE_INITIALIZER;
+//
+//
+// template <>
+// ProfileKeyedAPIFactory<ApiResourceManager<Resource> >*
+// ApiResourceManager<Resource>::GetFactoryInstance() {
+// return &g_factory.Get();
+// }
template <class T>
-class ApiResourceManager : public BrowserContextKeyedService,
+class ApiResourceManager : public ProfileKeyedAPI,
public base::NonThreadSafe,
public content::NotificationObserver {
public:
- explicit ApiResourceManager(const BrowserThread::ID thread_id)
- : thread_id_(thread_id),
- data_(new ApiResourceData(thread_id)) {
- registrar_.Add(this,
+ explicit ApiResourceManager(Profile* profile)
+ : thread_id_(T::kThreadId),
+ data_(new ApiResourceData(thread_id_)) {
+ registrar_.Add(
+ this,
chrome::NOTIFICATION_EXTENSION_UNLOADED,
content::NotificationService::AllSources());
}
+ // For Testing.
+ static ApiResourceManager<T>* CreateApiResourceManagerForTest(
+ Profile* profile,
+ content::BrowserThread::ID thread_id) {
+ ApiResourceManager* manager = new ApiResourceManager<T>(profile);
+ manager->thread_id_ = thread_id;
+ manager->data_.reset(new ApiResourceData(thread_id));
+ return manager;
+ }
+
virtual ~ApiResourceManager() {
DCHECK(CalledOnValidThread());
- DCHECK(BrowserThread::IsMessageLoopValid(thread_id_)) <<
+ DCHECK(content::BrowserThread::IsMessageLoopValid(thread_id_)) <<
"A unit test is using an ApiResourceManager but didn't provide "
"the thread message loop needed for that kind of resource. "
"Please ensure that the appropriate message loop is operational.";
- BrowserThread::DeleteSoon(thread_id_, FROM_HERE, data_.release());
+ content::BrowserThread::DeleteSoon(thread_id_, FROM_HERE, data_.release());
+ }
+
+ // ProfileKeyedAPI implementation.
+ static ProfileKeyedAPIFactory<ApiResourceManager<T> >* GetFactoryInstance();
+
+ // Convenience method to get the ApiResourceManager for a profile.
+ static ApiResourceManager<T>* Get(Profile* profile) {
+ return ProfileKeyedAPIFactory<ApiResourceManager<T> >::GetForProfile(
+ profile);
}
// Takes ownership.
@@ -76,6 +130,13 @@ class ApiResourceManager : public BrowserContextKeyedService,
}
private:
+ friend class ProfileKeyedAPIFactory<ApiResourceManager<T> >;
+ // ProfileKeyedAPI implementation.
+ static const char* service_name() {
+ return T::service_name();
+ }
+ static const bool kServiceHasOwnInstanceInIncognito = true;
+ static const bool kServiceIsNULLWhileTesting = true;
// ApiResourceData class handles resource bookkeeping on a thread
// where resource lifetime is handled.
@@ -85,13 +146,13 @@ class ApiResourceManager : public BrowserContextKeyedService,
// Lookup map from extension id's to allocated resource id's.
typedef std::map<std::string, base::hash_set<int> > ExtensionToResourceMap;
- explicit ApiResourceData(const BrowserThread::ID thread_id)
+ explicit ApiResourceData(const content::BrowserThread::ID thread_id)
: next_id_(1),
thread_id_(thread_id) {
}
int Add(T* api_resource) {
- DCHECK(BrowserThread::CurrentlyOn(thread_id_));
+ DCHECK(content::BrowserThread::CurrentlyOn(thread_id_));
int id = GenerateId();
if (id > 0) {
linked_ptr<T> resource_ptr(api_resource);
@@ -110,7 +171,7 @@ class ApiResourceManager : public BrowserContextKeyedService,
}
void Remove(const std::string& extension_id, int api_resource_id) {
- DCHECK(BrowserThread::CurrentlyOn(thread_id_));
+ DCHECK(content::BrowserThread::CurrentlyOn(thread_id_));
if (GetOwnedResource(extension_id, api_resource_id) != NULL) {
DCHECK(extension_resource_map_.find(extension_id) !=
extension_resource_map_.end());
@@ -120,12 +181,12 @@ class ApiResourceManager : public BrowserContextKeyedService,
}
T* Get(const std::string& extension_id, int api_resource_id) {
- DCHECK(BrowserThread::CurrentlyOn(thread_id_));
+ DCHECK(content::BrowserThread::CurrentlyOn(thread_id_));
return GetOwnedResource(extension_id, api_resource_id);
}
void InitiateCleanup(const std::string& extension_id) {
- BrowserThread::PostTask(thread_id_, FROM_HERE,
+ content::BrowserThread::PostTask(thread_id_, FROM_HERE,
base::Bind(&ApiResourceData::CleanupResourcesFromExtension,
base::Unretained(this), extension_id));
}
@@ -141,7 +202,7 @@ class ApiResourceManager : public BrowserContextKeyedService,
}
void CleanupResourcesFromExtension(const std::string& extension_id) {
- DCHECK(BrowserThread::CurrentlyOn(thread_id_));
+ DCHECK(content::BrowserThread::CurrentlyOn(thread_id_));
if (extension_resource_map_.find(extension_id) !=
extension_resource_map_.end()) {
base::hash_set<int>& resource_ids =
@@ -159,12 +220,12 @@ class ApiResourceManager : public BrowserContextKeyedService,
}
int next_id_;
- const BrowserThread::ID thread_id_;
+ const content::BrowserThread::ID thread_id_;
ApiResourceMap api_resource_map_;
ExtensionToResourceMap extension_resource_map_;
};
- const BrowserThread::ID thread_id_;
+ content::BrowserThread::ID thread_id_;
content::NotificationRegistrar registrar_;
scoped_ptr<ApiResourceData> data_;
};
diff --git a/chrome/browser/extensions/api/api_resource_manager_unittest.cc b/chrome/browser/extensions/api/api_resource_manager_unittest.cc
index e903e29..c3218a2 100644
--- a/chrome/browser/extensions/api/api_resource_manager_unittest.cc
+++ b/chrome/browser/extensions/api/api_resource_manager_unittest.cc
@@ -30,14 +30,15 @@ class ApiResourceManagerUnitTest : public BrowserWithTestWindowTest {
class FakeApiResource : public ApiResource {
public:
- FakeApiResource(const std::string& owner_extension_id) :
+ explicit FakeApiResource(const std::string& owner_extension_id) :
ApiResource(owner_extension_id) {}
virtual ~FakeApiResource() {}
+ static const BrowserThread::ID kThreadId = BrowserThread::UI;
};
TEST_F(ApiResourceManagerUnitTest, TwoAppsCannotShareResources) {
scoped_ptr<ApiResourceManager<FakeApiResource> > manager(
- new ApiResourceManager<FakeApiResource>(BrowserThread::UI));
+ new ApiResourceManager<FakeApiResource>(NULL));
scoped_refptr<extensions::Extension> extension_one(
utils::CreateEmptyExtension("one"));
scoped_refptr<extensions::Extension> extension_two(
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
index 597e8ca..5915b54 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
@@ -7,6 +7,7 @@
#include <map>
#include <string>
+#include "base/bind.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index d111843..2ae2b7f 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -751,8 +751,8 @@ bool DebuggerGetTargetsFunction::RunImpl() {
results_list->Append(value);
}
- BrowserThread::PostTaskAndReply(
- BrowserThread::IO,
+ content::BrowserThread::PostTaskAndReply(
+ content::BrowserThread::IO,
FROM_HERE,
base::Bind(&DebuggerGetTargetsFunction::CollectWorkerInfo,
this,
diff --git a/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc b/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc
index 3c55f6a..9ac23db 100644
--- a/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc
+++ b/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc
@@ -10,8 +10,11 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension_messages.h"
#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
index 56e38fd..a72edc5 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
@@ -227,8 +227,8 @@ std::string WebRequestRulesRegistry::AddRulesImpl(
ClearCacheOnNavigation();
if (profile_id_ && !registered_rules.empty()) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
base::Bind(&extension_web_request_api_helpers::NotifyWebRequestAPIUsed,
profile_id_, make_scoped_refptr(extension)));
}
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index fd3d720..278d1d8 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -33,6 +33,7 @@
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/developer_private.h"
#include "chrome/common/extensions/background_info.h"
@@ -43,6 +44,7 @@
#include "chrome/common/extensions/manifest_url_handler.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/storage_partition.h"
diff --git a/chrome/browser/extensions/api/dial/dial_api.cc b/chrome/browser/extensions/api/dial/dial_api.cc
index 5f6b779..c790185 100644
--- a/chrome/browser/extensions/api/dial/dial_api.cc
+++ b/chrome/browser/extensions/api/dial/dial_api.cc
@@ -16,6 +16,7 @@
#include "content/public/browser/browser_thread.h"
using base::TimeDelta;
+using content::BrowserThread;
namespace {
@@ -35,7 +36,7 @@ const size_t kDialMaxDevices = 256;
namespace extensions {
DialAPI::DialAPI(Profile* profile)
- : RefcountedBrowserContextKeyedService(content::BrowserThread::IO),
+ : RefcountedBrowserContextKeyedService(BrowserThread::IO),
profile_(profile) {
ExtensionSystem::Get(profile)->event_router()->RegisterObserver(
this, extensions::event_names::kOnDialDeviceList);
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
index e92ab83..bdd3ff4 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -60,6 +60,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "net/base/load_flags.h"
+#include "net/base/net_util.h"
#include "net/http/http_util.h"
#include "net/url_request/url_request.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index a095d04..a2a5182 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -628,7 +628,7 @@ void FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest(
void FileSystemChooseEntryFunction::SetInitialPathOnFileThread(
const base::FilePath& suggested_name,
const base::FilePath& previous_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
if (!previous_path.empty() && file_util::DirectoryExists(previous_path)) {
initial_path_ = previous_path.Append(suggested_name);
} else {
@@ -759,8 +759,8 @@ bool FileSystemChooseEntryFunction::RunImpl() {
extension_prefs()->GetLastChooseEntryDirectory(
GetExtension()->id(), &previous_path);
- BrowserThread::PostTaskAndReply(
- BrowserThread::FILE,
+ content::BrowserThread::PostTaskAndReply(
+ content::BrowserThread::FILE,
FROM_HERE,
base::Bind(
&FileSystemChooseEntryFunction::SetInitialPathOnFileThread, this,
diff --git a/chrome/browser/extensions/api/file_system/file_system_apitest.cc b/chrome/browser/extensions/api/file_system/file_system_apitest.cc
index 0f6af50..11f5823 100644
--- a/chrome/browser/extensions/api/file_system/file_system_apitest.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_apitest.cc
@@ -10,8 +10,10 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/platform_app_browsertest_util.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_service.h"
using extensions::FileSystemChooseEntryFunction;
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index 8df916f..1f385fe 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/token_service.h"
#include "chrome/browser/signin/token_service_factory.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/api/identity.h"
#include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h"
#include "chrome/common/extensions/extension.h"
diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc
index 91e89b6..b0ad761 100644
--- a/chrome/browser/extensions/api/identity/web_auth_flow.cc
+++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc
@@ -20,6 +20,7 @@
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_view_host.h"
diff --git a/chrome/browser/extensions/api/idle/idle_manager.cc b/chrome/browser/extensions/api/idle/idle_manager.cc
index c5fee7e..c907b81 100644
--- a/chrome/browser/extensions/api/idle/idle_manager.cc
+++ b/chrome/browser/extensions/api/idle/idle_manager.cc
@@ -14,6 +14,8 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
namespace keys = extensions::idle_api_constants;
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
index a296ca0..c33eff7 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
@@ -15,7 +15,10 @@
#include "chrome/browser/extensions/extension_input_module_constants.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/api/input_ime/input_components_handler.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
namespace keys = extension_input_module_constants;
diff --git a/chrome/browser/extensions/api/location/location_manager.cc b/chrome/browser/extensions/api/location/location_manager.cc
index da1a2d8..509494e 100644
--- a/chrome/browser/extensions/api/location/location_manager.cc
+++ b/chrome/browser/extensions/api/location/location_manager.cc
@@ -8,11 +8,18 @@
#include "base/lazy_instance.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/api/location.h"
+#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/permissions/permission_set.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/geolocation_provider.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
#include "content/public/common/geoposition.h"
+using content::BrowserThread;
+
// TODO(vadimt): Add tests.
namespace extensions {
@@ -46,8 +53,7 @@ class LocationRequest
private:
friend class base::DeleteHelper<LocationRequest>;
- friend struct content::BrowserThread::DeleteOnThread<
- content::BrowserThread::IO>;
+ friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
virtual ~LocationRequest();
diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc
index a4dcb80..834cade 100644
--- a/chrome/browser/extensions/api/management/management_api_browsertest.cc
+++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/test_utils.h"
diff --git a/chrome/browser/extensions/api/messaging/native_message_port.cc b/chrome/browser/extensions/api/messaging/native_message_port.cc
index c340e33..7ca7bea 100644
--- a/chrome/browser/extensions/api/messaging/native_message_port.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_port.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/json/json_writer.h"
+#include "base/values.h"
#include "chrome/browser/extensions/api/messaging/native_message_process_host.h"
#include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/extensions/api/runtime/runtime_api.cc b/chrome/browser/extensions/api/runtime/runtime_api.cc
index 6b65a45..d00ab43 100644
--- a/chrome/browser/extensions/api/runtime/runtime_api.cc
+++ b/chrome/browser/extensions/api/runtime/runtime_api.cc
@@ -18,11 +18,13 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/api/runtime.h"
#include "chrome/common/extensions/background_info.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/omaha_query_params/omaha_query_params.h"
#include "content/public/browser/child_process_security_policy.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "extensions/common/error_utils.h"
diff --git a/chrome/browser/extensions/api/serial/serial_api.cc b/chrome/browser/extensions/api/serial/serial_api.cc
index 06a2240..1a36453 100644
--- a/chrome/browser/extensions/api/serial/serial_api.cc
+++ b/chrome/browser/extensions/api/serial/serial_api.cc
@@ -36,8 +36,9 @@ SerialAsyncApiFunction::~SerialAsyncApiFunction() {
}
bool SerialAsyncApiFunction::PrePrepare() {
- manager_ = ExtensionSystem::Get(profile())->serial_connection_manager();
- return manager_ != NULL;
+ manager_ = ApiResourceManager<SerialConnection>::Get(profile());
+ DCHECK(manager_);
+ return true;
}
SerialConnection* SerialAsyncApiFunction::GetSerialConnection(
diff --git a/chrome/browser/extensions/api/serial/serial_connection.cc b/chrome/browser/extensions/api/serial/serial_connection.cc
index 6bba9e7..ffa49b8 100644
--- a/chrome/browser/extensions/api/serial/serial_connection.cc
+++ b/chrome/browser/extensions/api/serial/serial_connection.cc
@@ -7,12 +7,25 @@
#include <string>
#include "base/files/file_path.h"
+#include "base/lazy_instance.h"
#include "base/strings/string_util.h"
+#include "chrome/browser/extensions/api/api_resource_manager.h"
namespace extensions {
const char kSerialConnectionNotFoundError[] = "Serial connection not found";
+static base::LazyInstance<ProfileKeyedAPIFactory<
+ ApiResourceManager<SerialConnection> > >
+ g_factory = LAZY_INSTANCE_INITIALIZER;
+
+// static
+template <>
+ProfileKeyedAPIFactory<ApiResourceManager<SerialConnection> >*
+ApiResourceManager<SerialConnection>::GetFactoryInstance() {
+ return &g_factory.Get();
+}
+
SerialConnection::SerialConnection(const std::string& port, int bitrate,
const std::string& owner_extension_id)
: ApiResource(owner_extension_id), port_(port), bitrate_(bitrate),
diff --git a/chrome/browser/extensions/api/serial/serial_connection.h b/chrome/browser/extensions/api/serial/serial_connection.h
index f7e16bc..3b838ba 100644
--- a/chrome/browser/extensions/api/serial/serial_connection.h
+++ b/chrome/browser/extensions/api/serial/serial_connection.h
@@ -55,6 +55,8 @@ class SerialConnection : public ApiResource {
virtual bool GetControlSignals(ControlSignals &control_signals);
virtual bool SetControlSignals(const ControlSignals &control_signals);
+ static const BrowserThread::ID kThreadId = BrowserThread::FILE;
+
protected:
// Do platform-specific work after a successful Open().
bool PostOpen();
@@ -63,6 +65,10 @@ class SerialConnection : public ApiResource {
static std::string MaybeFixUpPortName(const std::string &port_name);
private:
+ friend class ApiResourceManager<SerialConnection>;
+ static const char* service_name() {
+ return "SerialConnectionManager";
+ }
std::string port_;
int bitrate_;
base::PlatformFile file_;
diff --git a/chrome/browser/extensions/api/socket/socket.cc b/chrome/browser/extensions/api/socket/socket.cc
index e519539..0f526a2 100644
--- a/chrome/browser/extensions/api/socket/socket.cc
+++ b/chrome/browser/extensions/api/socket/socket.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/extensions/api/socket/socket.h"
#include "base/bind.h"
+#include "base/lazy_instance.h"
+#include "chrome/browser/extensions/api/api_resource_manager.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
@@ -15,6 +17,16 @@ namespace extensions {
const char kSocketTypeNotSupported[] = "Socket type does not support this API";
+static base::LazyInstance<ProfileKeyedAPIFactory<ApiResourceManager<Socket> > >
+ g_factory = LAZY_INSTANCE_INITIALIZER;
+
+// static
+template <>
+ProfileKeyedAPIFactory<ApiResourceManager<Socket> >*
+ApiResourceManager<Socket>::GetFactoryInstance() {
+ return &g_factory.Get();
+}
+
Socket::Socket(const std::string& owner_extension_id)
: ApiResource(owner_extension_id), is_connected_(false) {
}
diff --git a/chrome/browser/extensions/api/socket/socket.h b/chrome/browser/extensions/api/socket/socket.h
index 0f29d38..e1e5fb9 100644
--- a/chrome/browser/extensions/api/socket/socket.h
+++ b/chrome/browser/extensions/api/socket/socket.h
@@ -12,6 +12,7 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/api/api_resource.h"
+#include "chrome/browser/extensions/api/api_resource_manager.h"
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
@@ -105,6 +106,11 @@ class Socket : public ApiResource {
bool is_connected_;
private:
+ friend class ApiResourceManager<Socket>;
+ static const char* service_name() {
+ return "SocketManager";
+ }
+
struct WriteRequest {
WriteRequest(scoped_refptr<net::IOBuffer> io_buffer,
int byte_count,
diff --git a/chrome/browser/extensions/api/socket/socket_api.cc b/chrome/browser/extensions/api/socket/socket_api.cc
index b5f781d..b21769f 100644
--- a/chrome/browser/extensions/api/socket/socket_api.cc
+++ b/chrome/browser/extensions/api/socket/socket_api.cc
@@ -55,7 +55,7 @@ SocketAsyncApiFunction::~SocketAsyncApiFunction() {
}
bool SocketAsyncApiFunction::PrePrepare() {
- manager_ = ExtensionSystem::Get(profile())->socket_manager();
+ manager_ = ApiResourceManager<Socket>::Get(profile());
DCHECK(manager_) << "There is no socket manager. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
diff --git a/chrome/browser/extensions/api/socket/socket_api.h b/chrome/browser/extensions/api/socket/socket_api.h
index 99a7ef2..4e68c58 100644
--- a/chrome/browser/extensions/api/socket/socket_api.h
+++ b/chrome/browser/extensions/api/socket/socket_api.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_
+#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/api/api_function.h"
#include "chrome/browser/extensions/api/api_resource_manager.h"
@@ -79,6 +80,7 @@ class SocketCreateFunction : public SocketAsyncApiFunction {
virtual void Work() OVERRIDE;
private:
+ FRIEND_TEST_ALL_PREFIXES(SocketUnitTest, Create);
enum SocketType {
kSocketTypeInvalid = -1,
kSocketTypeTCP,
diff --git a/chrome/browser/extensions/api/socket/socket_api_unittest.cc b/chrome/browser/extensions/api/socket/socket_api_unittest.cc
index 9f27f33..1329872 100644
--- a/chrome/browser/extensions/api/socket/socket_api_unittest.cc
+++ b/chrome/browser/extensions/api/socket/socket_api_unittest.cc
@@ -4,6 +4,9 @@
#include "base/values.h"
#include "chrome/browser/browser_process_impl.h"
+#include "chrome/browser/extensions/api/api_function.h"
+#include "chrome/browser/extensions/api/api_resource_manager.h"
+#include "chrome/browser/extensions/api/socket/socket.h"
#include "chrome/browser/extensions/api/socket/socket_api.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/test_extension_system.h"
@@ -17,14 +20,21 @@ namespace utils = extension_function_test_utils;
namespace extensions {
+BrowserContextKeyedService* ApiResourceManagerTestFactory(
+ content::BrowserContext* profile) {
+ content::BrowserThread::ID id;
+ CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id));
+ return ApiResourceManager<Socket>::CreateApiResourceManagerForTest(
+ static_cast<Profile*>(profile), id);
+}
+
class SocketUnitTest : public BrowserWithTestWindowTest {
public:
virtual void SetUp() {
BrowserWithTestWindowTest::SetUp();
- TestExtensionSystem* system = static_cast<TestExtensionSystem*>(
- ExtensionSystem::Get(browser()->profile()));
- system->CreateSocketManager();
+ ApiResourceManager<Socket>::GetFactoryInstance()->SetTestingFactoryAndUse(
+ browser()->profile(), ApiResourceManagerTestFactory);
extension_ = utils::CreateEmptyExtensionWithLocation(
extensions::Manifest::UNPACKED);
@@ -48,15 +58,18 @@ class SocketUnitTest : public BrowserWithTestWindowTest {
};
TEST_F(SocketUnitTest, Create) {
- // TODO(miket): enable this test. This will require teaching
- // SocketCreateFunction to do its work on a thread other than IO. Getting
- // this CL landed was hard enough already, so we're going to save this work
- // for another day.
- if (false) {
- scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDict(
- new SocketCreateFunction(), "[\"tcp\"]"));
- ASSERT_TRUE(result.get());
- }
+ // Get BrowserThread
+ content::BrowserThread::ID id;
+ CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id));
+
+ // Create SocketCreateFunction and put it on BrowserThread
+ SocketCreateFunction *function = new SocketCreateFunction();
+ function->set_work_thread_id(id);
+
+ // Run tests
+ scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDict(
+ function, "[\"tcp\"]"));
+ ASSERT_TRUE(result.get());
}
} // namespace extensions
diff --git a/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc b/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc
index 9e79826..ecc2573 100644
--- a/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc
+++ b/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc
@@ -7,8 +7,12 @@
#include "base/lazy_instance.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
+
namespace extensions {
namespace keys = extension_manifest_keys;
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
index d6cc08b..6710a32 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/value_store/value_store_change.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/extension_set.h"
@@ -32,6 +33,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/notification_source.h"
using content::BrowserThread;
diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.cc b/chrome/browser/extensions/api/streams_private/streams_private_api.cc
index 1a5c9f8..d87c9a0 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_api.cc
+++ b/chrome/browser/extensions/api/streams_private/streams_private_api.cc
@@ -15,6 +15,9 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
#include "content/public/browser/stream_handle.h"
namespace keys = extension_input_module_constants;
diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
index 9cb1f67..51cf082 100644
--- a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
+++ b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
@@ -14,8 +14,11 @@
#include "chrome/browser/status_icons/status_icon.h"
#include "chrome/browser/status_icons/status_icon_observer.h"
#include "chrome/browser/status_icons/status_tray.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/api/system_indicator.h"
#include "chrome/common/extensions/extension.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
#include "ui/gfx/image/image.h"
namespace extensions {
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
index 105a093..406d9de 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
@@ -14,6 +14,8 @@
#include "chrome/common/extensions/extension.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
diff --git a/chrome/browser/extensions/api/usb/usb_api.cc b/chrome/browser/extensions/api/usb/usb_api.cc
index 323f6bf..29aa7c3 100644
--- a/chrome/browser/extensions/api/usb/usb_api.cc
+++ b/chrome/browser/extensions/api/usb/usb_api.cc
@@ -31,6 +31,7 @@ namespace SetInterfaceAlternateSetting =
extensions::api::usb::SetInterfaceAlternateSetting;
namespace usb = extensions::api::usb;
+using content::BrowserThread;
using std::string;
using std::vector;
using usb::ControlTransferInfo;
@@ -337,7 +338,7 @@ UsbAsyncApiFunction::~UsbAsyncApiFunction() {
}
bool UsbAsyncApiFunction::PrePrepare() {
- manager_ = ExtensionSystem::Get(profile())->usb_device_resource_manager();
+ manager_ = ApiResourceManager<UsbDeviceResource>::Get(profile());
return manager_ != NULL;
}
diff --git a/chrome/browser/extensions/api/usb/usb_device_resource.cc b/chrome/browser/extensions/api/usb/usb_device_resource.cc
index 0e8b6b3..4d8aa95 100644
--- a/chrome/browser/extensions/api/usb/usb_device_resource.cc
+++ b/chrome/browser/extensions/api/usb/usb_device_resource.cc
@@ -16,6 +16,17 @@
namespace extensions {
+static base::LazyInstance<ProfileKeyedAPIFactory<
+ ApiResourceManager<UsbDeviceResource> > >
+ g_factory = LAZY_INSTANCE_INITIALIZER;
+
+// static
+template <>
+ProfileKeyedAPIFactory<ApiResourceManager<UsbDeviceResource> >*
+ApiResourceManager<UsbDeviceResource>::GetFactoryInstance() {
+ return &g_factory.Get();
+}
+
UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id,
scoped_refptr<UsbDevice> device)
: ApiResource(owner_extension_id), device_(device) {}
diff --git a/chrome/browser/extensions/api/usb/usb_device_resource.h b/chrome/browser/extensions/api/usb/usb_device_resource.h
index eed0a93..15fcca0 100644
--- a/chrome/browser/extensions/api/usb/usb_device_resource.h
+++ b/chrome/browser/extensions/api/usb/usb_device_resource.h
@@ -12,6 +12,7 @@
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "chrome/browser/extensions/api/api_resource.h"
+#include "chrome/browser/extensions/api/api_resource_manager.h"
#include "chrome/browser/usb/usb_device.h"
#include "chrome/common/extensions/api/usb.h"
@@ -35,6 +36,11 @@ class UsbDeviceResource : public ApiResource {
}
private:
+ friend class ApiResourceManager<UsbDeviceResource>;
+ static const char* service_name() {
+ return "UsbDeviceResourceManager";
+ }
+
scoped_refptr<UsbDevice> device_;
DISALLOW_COPY_AND_ASSIGN(UsbDeviceResource);
diff --git a/chrome/browser/extensions/event_router_forwarder.cc b/chrome/browser/extensions/event_router_forwarder.cc
index f094608..50b0d8f 100644
--- a/chrome/browser/extensions/event_router_forwarder.cc
+++ b/chrome/browser/extensions/event_router_forwarder.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "content/public/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
using content::BrowserThread;
diff --git a/chrome/browser/extensions/extension_blacklist_browsertest.cc b/chrome/browser/extensions/extension_blacklist_browsertest.cc
index 4051c9f..4c590fc 100644
--- a/chrome/browser/extensions/extension_blacklist_browsertest.cc
+++ b/chrome/browser/extensions/extension_blacklist_browsertest.cc
@@ -15,6 +15,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
namespace extensions {
diff --git a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
index 8eb5228..c6481b5 100644
--- a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
+++ b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_utils.h"
#include "content/test/net/url_request_prepackaged_interceptor.h"
#include "net/url_request/url_fetcher.h"
@@ -81,7 +82,7 @@ class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest {
size_t size_before = service_->extensions()->size();
if (UpdateExtension(extension->id(), crx_path, expected_change))
return NULL;
- BrowserThread::GetBlockingPool()->FlushForTesting();
+ content::BrowserThread::GetBlockingPool()->FlushForTesting();
base::RunLoop().RunUntilIdle();
EXPECT_EQ(size_before + expected_change, service_->extensions()->size());
if (service_->disabled_extensions()->size() != 1u)
@@ -211,7 +212,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest,
EXPECT_FALSE(service_->ProcessExtensionSyncData(sync_data));
WaitForExtensionInstall();
- BrowserThread::GetBlockingPool()->FlushForTesting();
+ content::BrowserThread::GetBlockingPool()->FlushForTesting();
base::RunLoop().RunUntilIdle();
extension = service_->GetExtensionById(extension_id, true);
diff --git a/chrome/browser/extensions/extension_functional_browsertest.cc b/chrome/browser/extensions/extension_functional_browsertest.cc
index a1c5c91..2699094 100644
--- a/chrome/browser/extensions/extension_functional_browsertest.cc
+++ b/chrome/browser/extensions/extension_functional_browsertest.cc
@@ -7,7 +7,9 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_commands.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/browser/notification_service.h"
namespace extensions {
diff --git a/chrome/browser/extensions/extension_system.cc b/chrome/browser/extensions/extension_system.cc
index 0babc26..a2ae1f3 100644
--- a/chrome/browser/extensions/extension_system.cc
+++ b/chrome/browser/extensions/extension_system.cc
@@ -305,12 +305,6 @@ void ExtensionSystemImpl::InitForRegularProfile(bool extensions_enabled) {
extension_process_manager_.reset(ExtensionProcessManager::Create(profile_));
- serial_connection_manager_.reset(new ApiResourceManager<SerialConnection>(
- BrowserThread::FILE));
- socket_manager_.reset(new ApiResourceManager<Socket>(BrowserThread::IO));
- usb_device_resource_manager_.reset(
- new ApiResourceManager<UsbDeviceResource>(BrowserThread::IO));
-
shared_->Init(extensions_enabled);
}
@@ -350,20 +344,6 @@ EventRouter* ExtensionSystemImpl::event_router() {
return shared_->event_router();
}
-ApiResourceManager<SerialConnection>*
-ExtensionSystemImpl::serial_connection_manager() {
- return serial_connection_manager_.get();
-}
-
-ApiResourceManager<Socket>* ExtensionSystemImpl::socket_manager() {
- return socket_manager_.get();
-}
-
-ApiResourceManager<UsbDeviceResource>*
-ExtensionSystemImpl::usb_device_resource_manager() {
- return usb_device_resource_manager_.get();
-}
-
ExtensionWarningService* ExtensionSystemImpl::warning_service() {
return shared_->warning_service();
}
diff --git a/chrome/browser/extensions/extension_system.h b/chrome/browser/extensions/extension_system.h
index 055aa2e..69464d3 100644
--- a/chrome/browser/extensions/extension_system.h
+++ b/chrome/browser/extensions/extension_system.h
@@ -9,10 +9,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/extensions/api/api_resource_manager.h"
-#include "chrome/browser/extensions/api/serial/serial_connection.h"
-#include "chrome/browser/extensions/api/socket/socket.h"
-#include "chrome/browser/extensions/api/usb/usb_device_resource.h"
#include "chrome/common/extensions/extension_constants.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "extensions/common/one_shot_event.h"
@@ -23,8 +19,6 @@ class ExtensionService;
class Profile;
namespace extensions {
-// Unfortunately, for the ApiResourceManager<> template classes, we don't seem
-// to be able to forward-declare because of compilation errors on Windows.
class Blacklist;
class EventRouter;
class Extension;
@@ -89,18 +83,6 @@ class ExtensionSystem : public BrowserContextKeyedService {
// The EventRouter is created at startup.
virtual EventRouter* event_router() = 0;
- // The SerialConnection ResourceManager is created at startup.
- virtual ApiResourceManager<SerialConnection>*
- serial_connection_manager() = 0;
-
- // The Socket ResourceManager is created at startup.
- virtual ApiResourceManager<Socket>*
- socket_manager() = 0;
-
- // The UsbDeviceResource ResourceManager is created at startup.
- virtual ApiResourceManager<UsbDeviceResource>*
- usb_device_resource_manager() = 0;
-
// The ExtensionWarningService is created at startup.
virtual ExtensionWarningService* warning_service() = 0;
@@ -151,11 +133,6 @@ class ExtensionSystemImpl : public ExtensionSystem {
OVERRIDE; // shared
virtual ExtensionInfoMap* info_map() OVERRIDE; // shared
virtual EventRouter* event_router() OVERRIDE; // shared
- virtual ApiResourceManager<SerialConnection>* serial_connection_manager()
- OVERRIDE;
- virtual ApiResourceManager<Socket>* socket_manager() OVERRIDE;
- virtual ApiResourceManager<UsbDeviceResource>* usb_device_resource_manager()
- OVERRIDE;
virtual ExtensionWarningService* warning_service() OVERRIDE;
virtual Blacklist* blacklist() OVERRIDE; // shared
@@ -236,10 +213,6 @@ class ExtensionSystemImpl : public ExtensionSystem {
// incoming resource requests from extension processes and those require
// access to the ResourceContext owned by |io_data_|.
scoped_ptr<ExtensionProcessManager> extension_process_manager_;
- scoped_ptr<ApiResourceManager<SerialConnection> > serial_connection_manager_;
- scoped_ptr<ApiResourceManager<Socket> > socket_manager_;
- scoped_ptr<ApiResourceManager<
- UsbDeviceResource> > usb_device_resource_manager_;
DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl);
};
diff --git a/chrome/browser/extensions/test_extension_system.cc b/chrome/browser/extensions/test_extension_system.cc
index b3ed09f..56d48d8 100644
--- a/chrome/browser/extensions/test_extension_system.cc
+++ b/chrome/browser/extensions/test_extension_system.cc
@@ -46,17 +46,6 @@ void TestExtensionSystem::CreateExtensionProcessManager() {
extension_process_manager_.reset(ExtensionProcessManager::Create(profile_));
}
-void TestExtensionSystem::CreateSocketManager() {
- // Note that we're intentionally creating the socket manager on the wrong
- // thread (not the IO thread). This is because we don't want to presume or
- // require that there be an IO thread in a lightweight test context. If we do
- // need thread-specific behavior someday, we'll probably need something like
- // CreateSocketManagerOnThreadForTesting(thread_id). But not today.
- BrowserThread::ID id;
- CHECK(BrowserThread::GetCurrentThreadIdentifier(&id));
- socket_manager_.reset(new ApiResourceManager<Socket>(id));
-}
-
ExtensionPrefs* TestExtensionSystem::CreateExtensionPrefs(
const CommandLine* command_line,
const base::FilePath& install_directory) {
@@ -148,20 +137,6 @@ EventRouter* TestExtensionSystem::event_router() {
return NULL;
}
-ApiResourceManager<SerialConnection>*
-TestExtensionSystem::serial_connection_manager() {
- return NULL;
-}
-
-ApiResourceManager<Socket>*TestExtensionSystem::socket_manager() {
- return socket_manager_.get();
-}
-
-ApiResourceManager<UsbDeviceResource>*
-TestExtensionSystem::usb_device_resource_manager() {
- return NULL;
-}
-
ExtensionWarningService* TestExtensionSystem::warning_service() {
return NULL;
}
diff --git a/chrome/browser/extensions/test_extension_system.h b/chrome/browser/extensions/test_extension_system.h
index 7186e93..8701af4 100644
--- a/chrome/browser/extensions/test_extension_system.h
+++ b/chrome/browser/extensions/test_extension_system.h
@@ -62,11 +62,6 @@ class TestExtensionSystem : public ExtensionSystem {
virtual ExtensionInfoMap* info_map() OVERRIDE;
virtual LazyBackgroundTaskQueue* lazy_background_task_queue() OVERRIDE;
virtual EventRouter* event_router() OVERRIDE;
- virtual ApiResourceManager<SerialConnection>* serial_connection_manager()
- OVERRIDE;
- virtual ApiResourceManager<Socket>* socket_manager() OVERRIDE;
- virtual ApiResourceManager<UsbDeviceResource>* usb_device_resource_manager()
- OVERRIDE;
virtual ExtensionWarningService* warning_service() OVERRIDE;
virtual Blacklist* blacklist() OVERRIDE;
virtual const OneShotEvent& ready() const OVERRIDE;
@@ -88,7 +83,6 @@ class TestExtensionSystem : public ExtensionSystem {
scoped_ptr<ExtensionService> extension_service_;
scoped_ptr<ExtensionProcessManager> extension_process_manager_;
scoped_refptr<ExtensionInfoMap> info_map_;
- scoped_ptr<ApiResourceManager<Socket> > socket_manager_;
OneShotEvent ready_;
};
diff --git a/chrome/browser/extensions/web_view_interactive_browsertest.cc b/chrome/browser/extensions/web_view_interactive_browsertest.cc
index e7af45e..5d854bd 100644
--- a/chrome/browser/extensions/web_view_interactive_browsertest.cc
+++ b/chrome/browser/extensions/web_view_interactive_browsertest.cc
@@ -11,6 +11,7 @@
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/test_launcher_utils.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/managed_mode/managed_user_service.cc
index 1fb88e1..7ad603a 100644
--- a/chrome/browser/managed_mode/managed_user_service.cc
+++ b/chrome/browser/managed_mode/managed_user_service.cc
@@ -37,6 +37,8 @@
#include "chrome/common/pref_names.h"
#include "components/user_prefs/pref_registry_syncable.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
index 4ceeada..c7b4adc 100644
--- a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
+++ b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
@@ -60,6 +60,8 @@
#include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h"
#endif
+using content::BrowserThread;
+
namespace chrome {
// Not anonymous so it can be friends with MediaFileSystemRegistry.
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
index 4ca3d0d..8b1887b 100644
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h"
#include "chrome/browser/extensions/api/alarms/alarm_manager.h"
+#include "chrome/browser/extensions/api/api_resource_manager.h"
#include "chrome/browser/extensions/api/audio/audio_api.h"
#include "chrome/browser/extensions/api/bluetooth/bluetooth_api_factory.h"
#include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h"
@@ -39,12 +40,15 @@
#include "chrome/browser/extensions/api/preference/preference_api.h"
#include "chrome/browser/extensions/api/processes/processes_api.h"
#include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h"
+#include "chrome/browser/extensions/api/serial/serial_connection.h"
#include "chrome/browser/extensions/api/session_restore/session_restore_api.h"
+#include "chrome/browser/extensions/api/socket/socket.h"
#include "chrome/browser/extensions/api/spellcheck/spellcheck_api.h"
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
#include "chrome/browser/extensions/api/system_info/system_info_api.h"
#include "chrome/browser/extensions/api/tab_capture/tab_capture_registry_factory.h"
#include "chrome/browser/extensions/api/tabs/tabs_windows_api.h"
+#include "chrome/browser/extensions/api/usb/usb_device_resource.h"
#include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h"
#include "chrome/browser/extensions/extension_prefs_factory.h"
#include "chrome/browser/extensions/extension_system_factory.h"
@@ -185,6 +189,11 @@ EnsureBrowserContextKeyedServiceFactoriesBuilt() {
extensions::ActivityLogFactory::GetInstance();
extensions::ActivityLogAPI::GetFactoryInstance();
extensions::AlarmManager::GetFactoryInstance();
+ extensions::ApiResourceManager<extensions::SerialConnection>::
+ GetFactoryInstance();
+ extensions::ApiResourceManager<extensions::Socket>::GetFactoryInstance();
+ extensions::ApiResourceManager<extensions::UsbDeviceResource>::
+ GetFactoryInstance();
extensions::AudioAPI::GetFactoryInstance();
extensions::BookmarksAPI::GetFactoryInstance();
extensions::BluetoothAPIFactory::GetInstance();
diff --git a/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc
index 6853ee5..56e6e32 100644
--- a/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc
+++ b/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc
@@ -13,6 +13,7 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/pepper_permission_util.h"
#include "content/public/browser/browser_ppapi_host.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_view_host.h"
#include "extensions/common/constants.h"
@@ -68,7 +69,8 @@ PepperCrxFileSystemMessageFilter::OverrideTaskRunnerForMessage(
const IPC::Message& msg) {
// In order to reach ExtensionSystem, we need to get ProfileManager first.
// ProfileManager lives in UI thread, so we need to do this in UI thread.
- return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
+ return content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::UI);
}
int32_t PepperCrxFileSystemMessageFilter::OnResourceMessageReceived(
@@ -82,7 +84,7 @@ int32_t PepperCrxFileSystemMessageFilter::OnResourceMessageReceived(
}
Profile* PepperCrxFileSystemMessageFilter::GetProfile() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
ProfileManager* profile_manager = g_browser_process->profile_manager();
return profile_manager->GetProfile(profile_directory_);
}
diff --git a/chrome/browser/task_manager/extension_process_resource_provider.cc b/chrome/browser/task_manager/extension_process_resource_provider.cc
index 46fae4f..219d311 100644
--- a/chrome/browser/task_manager/extension_process_resource_provider.cc
+++ b/chrome/browser/task_manager/extension_process_resource_provider.cc
@@ -16,7 +16,10 @@
#include "chrome/browser/task_manager/resource_provider.h"
#include "chrome/browser/task_manager/task_manager.h"
#include "chrome/browser/task_manager/task_manager_util.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/site_instance.h"
diff --git a/chrome/browser/themes/theme_syncable_service_unittest.cc b/chrome/browser/themes/theme_syncable_service_unittest.cc
index 3ff4195..4099223 100644
--- a/chrome/browser/themes/theme_syncable_service_unittest.cc
+++ b/chrome/browser/themes/theme_syncable_service_unittest.cc
@@ -163,8 +163,8 @@ class ThemeSyncableServiceTest : public testing::Test {
protected:
ThemeSyncableServiceTest()
: loop_(base::MessageLoop::TYPE_DEFAULT),
- ui_thread_(BrowserThread::UI, &loop_),
- file_thread_(BrowserThread::FILE, &loop_),
+ ui_thread_(content::BrowserThread::UI, &loop_),
+ file_thread_(content::BrowserThread::FILE, &loop_),
fake_theme_service_(NULL) {}
virtual ~ThemeSyncableServiceTest() {}
diff --git a/chrome/browser/ui/app_list/search/app_search_provider.cc b/chrome/browser/ui/app_list/search/app_search_provider.cc
index dbf777d..b3cd83b 100644
--- a/chrome/browser/ui/app_list/search/app_search_provider.cc
+++ b/chrome/browser/ui/app_list/search/app_search_provider.cc
@@ -13,6 +13,9 @@
#include "chrome/browser/ui/app_list/search/app_result.h"
#include "chrome/browser/ui/app_list/search/tokenized_string.h"
#include "chrome/browser/ui/app_list/search/tokenized_string_match.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
namespace app_list {
diff --git a/chrome/browser/ui/ash/app_sync_ui_state.cc b/chrome/browser/ui/ash/app_sync_ui_state.cc
index 8f35a2b..43d52da 100644
--- a/chrome/browser/ui/ash/app_sync_ui_state.cc
+++ b/chrome/browser/ui/ash/app_sync_ui_state.cc
@@ -14,7 +14,9 @@
#include "chrome/browser/ui/ash/app_sync_ui_state_factory.h"
#include "chrome/browser/ui/ash/app_sync_ui_state_observer.h"
#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/user_manager.h"
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
index 2776c5c..f13d629 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -38,6 +39,7 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/power_manager_client.h"
#include "chromeos/ime/input_method_manager.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 6ed98d1..74c466e 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -57,6 +57,7 @@
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/interstitial_page_delegate.h"
#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
diff --git a/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc b/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc
index 465995d..ad97ad9 100644
--- a/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc
+++ b/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc
@@ -116,7 +116,7 @@ static scoped_refptr<extensions::Extension> CreateExtension(
class ProfileSigninConfirmationHelperTest : public testing::Test {
public:
ProfileSigninConfirmationHelperTest()
- : ui_thread_(BrowserThread::UI, &message_loop_),
+ : ui_thread_(content::BrowserThread::UI, &message_loop_),
user_prefs_(NULL),
model_(NULL) {
}
diff --git a/chrome/browser/ui/views/browser_actions_container_browsertest.cc b/chrome/browser/ui/views/browser_actions_container_browsertest.cc
index 69605f6..937c717 100644
--- a/chrome/browser/ui/views/browser_actions_container_browsertest.cc
+++ b/chrome/browser/ui/views/browser_actions_container_browsertest.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/extensions/browser_action_test_util.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/common/chrome_notification_types.h"
#include "content/public/test/test_utils.h"
using extensions::Extension;