diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 12:01:15 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 12:01:15 +0000 |
commit | 3ce02419d4f7b3cd1fc062f87fb63a78072b5483 (patch) | |
tree | 6bdbb2cc363827fe8fb6186d5cbf5787f5aaf29d /chrome/browser/profiles | |
parent | af3f286560a8fadb4eb6cb51c7ba2cb0f8e17a66 (diff) | |
download | chromium_src-3ce02419d4f7b3cd1fc062f87fb63a78072b5483.zip chromium_src-3ce02419d4f7b3cd1fc062f87fb63a78072b5483.tar.gz chromium_src-3ce02419d4f7b3cd1fc062f87fb63a78072b5483.tar.bz2 |
Make the ChromeNetworkDelegate use the ExtensionEventRouterForwarder
BUG=73903
TEST=tests for proxy and webrequest API should still work
Review URL: http://codereview.chromium.org/6598002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profiles')
-rw-r--r-- | chrome/browser/profiles/off_the_record_profile_io_data.cc | 7 | ||||
-rw-r--r-- | chrome/browser/profiles/off_the_record_profile_io_data.h | 1 | ||||
-rw-r--r-- | chrome/browser/profiles/profile.cc | 6 | ||||
-rw-r--r-- | chrome/browser/profiles/profile.h | 6 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 10 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.h | 2 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl_io_data.cc | 7 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl_io_data.h | 2 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_io_data.cc | 3 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_io_data.h | 6 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_manager.cc | 13 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_manager.h | 4 |
12 files changed, 29 insertions, 38 deletions
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc index 72cce73..0ae8758 100644 --- a/chrome/browser/profiles/off_the_record_profile_io_data.cc +++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc @@ -9,7 +9,6 @@ #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_thread.h" -#include "chrome/browser/extensions/extension_io_event_router.h" #include "chrome/browser/io_thread.h" #include "chrome/browser/net/chrome_cookie_policy.h" #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" @@ -103,9 +102,9 @@ void OffTheRecordProfileIOData::LazyInitializeInternal() const { main_request_context_->set_net_log(lazy_params_->io_thread->net_log()); extensions_request_context_->set_net_log(lazy_params_->io_thread->net_log()); - extension_io_event_router_ = profile_params.extension_io_event_router; - network_delegate_.reset( - new ChromeNetworkDelegate(extension_io_event_router_)); + network_delegate_.reset(new ChromeNetworkDelegate( + io_thread_globals->extension_event_router_forwarder.get(), + profile_params.profile_id)); main_request_context_->set_network_delegate(network_delegate_.get()); main_request_context_->set_host_resolver( diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.h b/chrome/browser/profiles/off_the_record_profile_io_data.h index 98d73f7..3a6edf5 100644 --- a/chrome/browser/profiles/off_the_record_profile_io_data.h +++ b/chrome/browser/profiles/off_the_record_profile_io_data.h @@ -101,7 +101,6 @@ class OffTheRecordProfileIOData : public ProfileIOData { mutable scoped_refptr<RequestContext> media_request_context_; mutable scoped_refptr<RequestContext> extensions_request_context_; - mutable scoped_refptr<ExtensionIOEventRouter> extension_io_event_router_; mutable scoped_ptr<net::NetworkDelegate> network_delegate_; mutable scoped_ptr<net::DnsCertProvenanceChecker> dns_cert_checker_; mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index 348ad087..0575861 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -87,7 +87,7 @@ Profile::Profile() const char* Profile::kProfileKey = "__PROFILE__"; // static -const ProfileId Profile::InvalidProfileId = static_cast<ProfileId>(0); +const ProfileId Profile::kInvalidProfileId = static_cast<ProfileId>(0); // static void Profile::RegisterUserPrefs(PrefService* prefs) { @@ -286,10 +286,6 @@ class OffTheRecordProfileImpl : public Profile, return GetOriginalProfile()->GetExtensionEventRouter(); } - virtual ExtensionIOEventRouter* GetExtensionIOEventRouter() { - return GetOriginalProfile()->GetExtensionIOEventRouter(); - } - virtual ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() { return GetOriginalProfile()->GetExtensionSpecialStoragePolicy(); } diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index c45b072..8c80164 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -63,7 +63,6 @@ class Extension; class ExtensionDevToolsManager; class ExtensionEventRouter; class ExtensionInfoMap; -class ExtensionIOEventRouter; class ExtensionMessageService; class ExtensionPrefValueMap; class ExtensionProcessManager; @@ -142,7 +141,7 @@ class Profile { static const char* kProfileKey; // Value that represents no profile Id. - static const ProfileId InvalidProfileId; + static const ProfileId kInvalidProfileId; Profile(); virtual ~Profile() {} @@ -227,9 +226,6 @@ class Profile { // Accessor. The instance is created at startup. virtual ExtensionEventRouter* GetExtensionEventRouter() = 0; - // Accessor. The instance is created at startup. - virtual ExtensionIOEventRouter* GetExtensionIOEventRouter() = 0; - // Accessor. The instance is created upon first access. virtual ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() = 0; diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 3c05a6a..d80ef44 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -31,7 +31,6 @@ #include "chrome/browser/extensions/extension_error_reporter.h" #include "chrome/browser/extensions/extension_event_router.h" #include "chrome/browser/extensions/extension_info_map.h" -#include "chrome/browser/extensions/extension_io_event_router.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/extensions/extension_pref_store.h" #include "chrome/browser/extensions/extension_process_manager.h" @@ -312,7 +311,6 @@ ProfileImpl::ProfileImpl(const FilePath& path) background_contents_service_.reset( new BackgroundContentsService(this, CommandLine::ForCurrentProcess())); - extension_io_event_router_ = new ExtensionIOEventRouter(this); extension_info_map_ = new ExtensionInfoMap(); InitRegisteredProtocolHandlers(); @@ -363,7 +361,6 @@ void ProfileImpl::InitExtensions() { extension_process_manager_.reset(ExtensionProcessManager::Create(this)); extension_event_router_.reset(new ExtensionEventRouter(this)); - extension_io_event_router_ = new ExtensionIOEventRouter(this); extension_message_service_ = new ExtensionMessageService(this); ExtensionErrorReporter::Init(true); // allow noisy errors. @@ -585,9 +582,6 @@ ProfileImpl::~ProfileImpl() { // HistoryService first. favicon_service_ = NULL; - if (extension_io_event_router_) - extension_io_event_router_->DestroyingProfile(); - if (extension_message_service_) extension_message_service_->DestroyingProfile(); @@ -708,10 +702,6 @@ ExtensionEventRouter* ProfileImpl::GetExtensionEventRouter() { return extension_event_router_.get(); } -ExtensionIOEventRouter* ProfileImpl::GetExtensionIOEventRouter() { - return extension_io_event_router_.get(); -} - ExtensionSpecialStoragePolicy* ProfileImpl::GetExtensionSpecialStoragePolicy() { if (!extension_special_storage_policy_.get()) diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index ef35079..b2565b9 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -62,7 +62,6 @@ class ProfileImpl : public Profile, virtual ExtensionProcessManager* GetExtensionProcessManager(); virtual ExtensionMessageService* GetExtensionMessageService(); virtual ExtensionEventRouter* GetExtensionEventRouter(); - virtual ExtensionIOEventRouter* GetExtensionIOEventRouter(); virtual ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy(); virtual FaviconService* GetFaviconService(ServiceAccessType sat); virtual HistoryService* GetHistoryService(ServiceAccessType sat); @@ -201,7 +200,6 @@ class ProfileImpl : public Profile, scoped_ptr<ExtensionProcessManager> extension_process_manager_; scoped_refptr<ExtensionMessageService> extension_message_service_; scoped_ptr<ExtensionEventRouter> extension_event_router_; - scoped_refptr<ExtensionIOEventRouter> extension_io_event_router_; scoped_refptr<ExtensionSpecialStoragePolicy> extension_special_storage_policy_; scoped_ptr<SSLHostState> ssl_host_state_; diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc index 3fe1945..f2a91796 100644 --- a/chrome/browser/profiles/profile_impl_io_data.cc +++ b/chrome/browser/profiles/profile_impl_io_data.cc @@ -8,7 +8,6 @@ #include "base/logging.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_thread.h" -#include "chrome/browser/extensions/extension_io_event_router.h" #include "chrome/browser/io_thread.h" #include "chrome/browser/net/chrome_cookie_policy.h" #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" @@ -143,9 +142,9 @@ void ProfileImplIOData::LazyInitializeInternal() const { media_request_context_->set_net_log(lazy_params_->io_thread->net_log()); extensions_request_context_->set_net_log(lazy_params_->io_thread->net_log()); - extension_io_event_router_ = profile_params.extension_io_event_router; - network_delegate_.reset( - new ChromeNetworkDelegate(extension_io_event_router_)); + network_delegate_.reset(new ChromeNetworkDelegate( + io_thread_globals->extension_event_router_forwarder.get(), + profile_params.profile_id)); main_request_context_->set_network_delegate(network_delegate_.get()); media_request_context_->set_network_delegate(network_delegate_.get()); diff --git a/chrome/browser/profiles/profile_impl_io_data.h b/chrome/browser/profiles/profile_impl_io_data.h index d4fcfc0..f7be093 100644 --- a/chrome/browser/profiles/profile_impl_io_data.h +++ b/chrome/browser/profiles/profile_impl_io_data.h @@ -10,7 +10,6 @@ #include "base/ref_counted.h" #include "chrome/browser/profiles/profile_io_data.h" -class ExtensionIOEventRouter; namespace net { class NetworkDelegate; class DnsCertProvenanceChecker; @@ -111,7 +110,6 @@ class ProfileImplIOData : public ProfileIOData { mutable scoped_refptr<RequestContext> media_request_context_; mutable scoped_refptr<RequestContext> extensions_request_context_; - mutable scoped_refptr<ExtensionIOEventRouter> extension_io_event_router_; mutable scoped_ptr<net::NetworkDelegate> network_delegate_; mutable scoped_ptr<net::DnsCertProvenanceChecker> dns_cert_checker_; mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 9553c85..56371a8 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -10,7 +10,6 @@ #include "base/string_number_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_thread.h" -#include "chrome/browser/extensions/extension_io_event_router.h" #include "chrome/browser/io_thread.h" #include "chrome/browser/net/chrome_cookie_notification_details.h" #include "chrome/browser/net/pref_proxy_config_service.h" @@ -168,11 +167,11 @@ void ProfileIOData::InitializeProfileParams(Profile* profile, params->blob_storage_context = profile->GetBlobStorageContext(); params->file_system_context = profile->GetFileSystemContext(); params->extension_info_map = profile->GetExtensionInfoMap(); - params->extension_io_event_router = profile->GetExtensionIOEventRouter(); params->prerender_manager = profile->GetPrerenderManager(); params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); params->proxy_config_service.reset(CreateProxyConfigService(profile)); + params->profile_id = profile->GetRuntimeId(); } ProfileIOData::RequestContext::RequestContext() {} diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h index ce65191..63ed3ac 100644 --- a/chrome/browser/profiles/profile_io_data.h +++ b/chrome/browser/profiles/profile_io_data.h @@ -11,6 +11,7 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "chrome/browser/net/chrome_url_request_context.h" +#include "chrome/browser/profiles/profile.h" #include "net/base/cookie_monster.h" class CommandLine; @@ -19,7 +20,6 @@ class ChromeBlobStorageContext; class ChromeURLRequestContext; class ChromeURLRequestContextGetter; class ExtensionInfoMap; -class ExtensionIOEventRouter; namespace fileapi { class FileSystemContext; } @@ -37,7 +37,6 @@ class TransportSecurityState; namespace prerender { class PrerenderManager; }; // namespace prerender -class Profile; namespace webkit_database { class DatabaseTracker; } // webkit_database @@ -103,13 +102,14 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> { scoped_refptr<ChromeBlobStorageContext> blob_storage_context; scoped_refptr<fileapi::FileSystemContext> file_system_context; scoped_refptr<ExtensionInfoMap> extension_info_map; - scoped_refptr<ExtensionIOEventRouter> extension_io_event_router; scoped_refptr<prerender::PrerenderManager> prerender_manager; scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry; // We need to initialize the ProxyConfigService from the UI thread // because on linux it relies on initializing things through gconf, // and needs to be on the main thread. scoped_ptr<net::ProxyConfigService> proxy_config_service; + // The profile this struct was populated from. + ProfileId profile_id; }; explicit ProfileIOData(bool is_off_the_record); diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index f318724..c44e218 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -139,6 +139,19 @@ Profile* ProfileManager::GetProfile(const FilePath& profile_dir) { return GetProfile(profile_dir, true); } +Profile* ProfileManager::GetProfileWithId(ProfileId profile_id) { + DCHECK_NE(Profile::kInvalidProfileId, profile_id); + for (iterator i = begin(); i != end(); ++i) { + if ((*i)->GetRuntimeId() == profile_id) + return *i; + if ((*i)->HasOffTheRecordProfile() && + (*i)->GetOffTheRecordProfile()->GetRuntimeId() == profile_id) { + return (*i)->GetOffTheRecordProfile(); + } + } + return NULL; +} + bool ProfileManager::IsValidProfile(Profile* profile) { for (iterator i = begin(); i != end(); ++i) { if (*i == profile) diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h index 95741cf..a5b8884 100644 --- a/chrome/browser/profiles/profile_manager.h +++ b/chrome/browser/profiles/profile_manager.h @@ -44,6 +44,10 @@ class ProfileManager : public base::NonThreadSafe, // otherwise it will create and manage it. Profile* GetProfile(const FilePath& profile_dir); + // Returns the profile with the given |profile_id| or NULL if no such profile + // exists. + Profile* GetProfileWithId(ProfileId profile_id); + // Returns true if the profile pointer is known to point to an existing // profile. bool IsValidProfile(Profile* profile); |