diff options
35 files changed, 163 insertions, 243 deletions
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h index c1275db..1eb9f03 100644 --- a/chrome/browser/browser_process.h +++ b/chrome/browser/browser_process.h @@ -27,6 +27,7 @@ class ChromeNetLog; class DevToolsManager; class DownloadRequestLimiter; class DownloadStatusUpdater; +class ExtensionEventRouterForwarder; class GoogleURLTracker; class IconManager; class IntranetRedirectDetector; @@ -80,6 +81,8 @@ class BrowserProcess { virtual DevToolsManager* devtools_manager() = 0; virtual SidebarManager* sidebar_manager() = 0; virtual ui::Clipboard* clipboard() = 0; + virtual ExtensionEventRouterForwarder* + extension_event_router_forwarder() = 0; // Returns the manager for desktop notifications. virtual NotificationUIManager* notification_ui_manager() = 0; diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index a168a61..7579efc 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -24,6 +24,7 @@ #include "chrome/browser/debugger/devtools_protocol_handler.h" #include "chrome/browser/download/download_file_manager.h" #include "chrome/browser/download/save_file_manager.h" +#include "chrome/browser/extensions/extension_event_router_forwarder.h" #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/google/google_url_tracker.h" #include "chrome/browser/icon_manager.h" @@ -124,6 +125,8 @@ BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) shutdown_event_.reset(new base::WaitableEvent(true, false)); net_log_.reset(new ChromeNetLog); + + extension_event_router_forwarder_ = new ExtensionEventRouterForwarder; } BrowserProcessImpl::~BrowserProcessImpl() { @@ -423,6 +426,11 @@ ui::Clipboard* BrowserProcessImpl::clipboard() { return clipboard_.get(); } +ExtensionEventRouterForwarder* +BrowserProcessImpl::extension_event_router_forwarder() { + return extension_event_router_forwarder_.get(); +} + NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { DCHECK(CalledOnValidThread()); if (!created_notification_ui_manager_) @@ -663,7 +671,8 @@ void BrowserProcessImpl::CreateIOThread() { background_x11_thread_.swap(background_x11_thread); #endif - scoped_ptr<IOThread> thread(new IOThread(local_state(), net_log_.get())); + scoped_ptr<IOThread> thread(new IOThread( + local_state(), net_log_.get(), extension_event_router_forwarder_.get())); base::Thread::Options options; options.message_loop_type = MessageLoop::TYPE_IO; if (!thread->StartWithOptions(options)) diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 4926812..581650a 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -62,6 +62,7 @@ class BrowserProcessImpl : public BrowserProcess, virtual DevToolsManager* devtools_manager(); virtual SidebarManager* sidebar_manager(); virtual ui::Clipboard* clipboard(); + virtual ExtensionEventRouterForwarder* extension_event_router_forwarder(); virtual NotificationUIManager* notification_ui_manager(); virtual policy::BrowserPolicyConnector* browser_policy_connector(); virtual IconManager* icon_manager(); @@ -179,6 +180,9 @@ class BrowserProcessImpl : public BrowserProcess, bool created_icon_manager_; scoped_ptr<IconManager> icon_manager_; + scoped_refptr<ExtensionEventRouterForwarder> + extension_event_router_forwarder_; + scoped_refptr<DevToolsHttpProtocolHandler> devtools_http_handler_; scoped_refptr<DevToolsProtocolHandler> devtools_legacy_handler_; diff --git a/chrome/browser/chromeos/locale_change_guard.cc b/chrome/browser/chromeos/locale_change_guard.cc index bf992cd..e12d8d3 100644 --- a/chrome/browser/chromeos/locale_change_guard.cc +++ b/chrome/browser/chromeos/locale_change_guard.cc @@ -43,7 +43,7 @@ class LocaleChangeGuard::Delegate : public NotificationDelegate { }; LocaleChangeGuard::LocaleChangeGuard() - : profile_id_(Profile::InvalidProfileId), + : profile_id_(Profile::kInvalidProfileId), tab_contents_(NULL), note_(NULL), reverted_(false) { diff --git a/chrome/browser/extensions/extension_event_router_forwarder.cc b/chrome/browser/extensions/extension_event_router_forwarder.cc index b018908..3b0b2d4 100644 --- a/chrome/browser/extensions/extension_event_router_forwarder.cc +++ b/chrome/browser/extensions/extension_event_router_forwarder.cc @@ -6,7 +6,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_event_router.h" -#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "googleurl/src/gurl.h" @@ -19,15 +18,16 @@ ExtensionEventRouterForwarder::~ExtensionEventRouterForwarder() { void ExtensionEventRouterForwarder::BroadcastEventToRenderers( const std::string& event_name, const std::string& event_args, const GURL& event_url) { - HandleEvent("", event_name, event_args, NULL, true, event_url); + HandleEvent("", event_name, event_args, 0, true, event_url); } void ExtensionEventRouterForwarder::DispatchEventToRenderers( const std::string& event_name, const std::string& event_args, - Profile* profile, bool use_profile_to_restrict_events, + ProfileId profile_id, bool use_profile_to_restrict_events, const GURL& event_url) { - DCHECK(profile); - HandleEvent("", event_name, event_args, profile, + if (profile_id == Profile::kInvalidProfileId) + return; + HandleEvent("", event_name, event_args, profile_id, use_profile_to_restrict_events, event_url); } @@ -35,23 +35,24 @@ void ExtensionEventRouterForwarder::BroadcastEventToExtension( const std::string& extension_id, const std::string& event_name, const std::string& event_args, const GURL& event_url) { - HandleEvent(extension_id, event_name, event_args, NULL, true, event_url); + HandleEvent(extension_id, event_name, event_args, 0, true, event_url); } void ExtensionEventRouterForwarder::DispatchEventToExtension( const std::string& extension_id, const std::string& event_name, const std::string& event_args, - Profile* profile, bool use_profile_to_restrict_events, + ProfileId profile_id, bool use_profile_to_restrict_events, const GURL& event_url) { - DCHECK(profile); - HandleEvent(extension_id, event_name, event_args, profile, + if (profile_id == Profile::kInvalidProfileId) + return; + HandleEvent(extension_id, event_name, event_args, profile_id, use_profile_to_restrict_events, event_url); } void ExtensionEventRouterForwarder::HandleEvent( const std::string& extension_id, const std::string& event_name, const std::string& event_args, - Profile* profile, bool use_profile_to_restrict_events, + ProfileId profile_id, bool use_profile_to_restrict_events, const GURL& event_url) { if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask( @@ -59,7 +60,7 @@ void ExtensionEventRouterForwarder::HandleEvent( NewRunnableMethod( this, &ExtensionEventRouterForwarder::HandleEvent, - extension_id, event_name, event_args, profile, + extension_id, event_name, event_args, profile_id, use_profile_to_restrict_events, event_url)); return; } @@ -68,9 +69,13 @@ void ExtensionEventRouterForwarder::HandleEvent( return; ProfileManager* profile_manager = g_browser_process->profile_manager(); - if (profile) { - if (!profile_manager->IsValidProfile(profile)) + Profile* profile = NULL; + if (profile_id != Profile::kInvalidProfileId) { + profile = profile_manager->GetProfileWithId(profile_id); + if (!profile) return; + } + if (profile) { CallExtensionEventRouter( profile, extension_id, event_name, event_args, use_profile_to_restrict_events ? profile : NULL, event_url); diff --git a/chrome/browser/extensions/extension_event_router_forwarder.h b/chrome/browser/extensions/extension_event_router_forwarder.h index 80ae672..e1f04881 100644 --- a/chrome/browser/extensions/extension_event_router_forwarder.h +++ b/chrome/browser/extensions/extension_event_router_forwarder.h @@ -11,9 +11,9 @@ #include "base/basictypes.h" #include "base/ref_counted.h" #include "chrome/browser/browser_thread.h" +#include "chrome/browser/profiles/profile.h" class GURL; -class Profile; // This class forwards events to ExtensionEventRouters. // The advantages of this class over direct usage of ExtensionEventRouters are: @@ -53,7 +53,7 @@ class ExtensionEventRouterForwarder // on |profile|'s ExtensionEventRouter. May be called on any thread. void DispatchEventToRenderers(const std::string& event_name, const std::string& event_args, - Profile* profile, + ProfileId profile_id, bool use_profile_to_restrict_events, const GURL& event_url); @@ -64,7 +64,7 @@ class ExtensionEventRouterForwarder void DispatchEventToExtension(const std::string& extension_id, const std::string& event_name, const std::string& event_args, - Profile* profile, + ProfileId profile_id, bool use_profile_to_restrict_events, const GURL& event_url); @@ -90,7 +90,7 @@ class ExtensionEventRouterForwarder void HandleEvent(const std::string& extension_id, const std::string& event_name, const std::string& event_args, - Profile* profile, + ProfileId profile_id, bool use_profile_to_restrict_events, const GURL& event_url); diff --git a/chrome/browser/extensions/extension_event_router_forwarder_unittest.cc b/chrome/browser/extensions/extension_event_router_forwarder_unittest.cc index 751133e..8bc2f9c 100644 --- a/chrome/browser/extensions/extension_event_router_forwarder_unittest.cc +++ b/chrome/browser/extensions/extension_event_router_forwarder_unittest.cc @@ -140,7 +140,8 @@ TEST_F(ExtensionEventRouterForwarderTest, UnicastRendererUIRestricted) { EXPECT_CALL(*event_router, CallExtensionEventRouter(profile2_, _, _, _, _, _)).Times(0); event_router->DispatchEventToRenderers(kEventName, kEventArgs, - profile1_, true, url); + profile1_->GetRuntimeId(), + true, url); } TEST_F(ExtensionEventRouterForwarderTest, @@ -158,7 +159,8 @@ TEST_F(ExtensionEventRouterForwarderTest, EXPECT_CALL(*event_router, CallExtensionEventRouter(profile2_, _, _, _, _, _)).Times(0); event_router->DispatchEventToRenderers(kEventName, kEventArgs, - profile1_, true, url); + profile1_->GetRuntimeId(), + true, url); } TEST_F(ExtensionEventRouterForwarderTest, @@ -176,7 +178,8 @@ TEST_F(ExtensionEventRouterForwarderTest, EXPECT_CALL(*event_router, CallExtensionEventRouter(profile2_, _, _, _, _, _)).Times(0); event_router->DispatchEventToRenderers(kEventName, kEventArgs, - incognito, true, url); + incognito->GetRuntimeId(), + true, url); } TEST_F(ExtensionEventRouterForwarderTest, UnicastRendererUIUnrestricted) { @@ -190,7 +193,8 @@ TEST_F(ExtensionEventRouterForwarderTest, UnicastRendererUIUnrestricted) { EXPECT_CALL(*event_router, CallExtensionEventRouter(profile2_, _, _, _, _, _)).Times(0); event_router->DispatchEventToRenderers(kEventName, kEventArgs, - profile1_, false, url); + profile1_->GetRuntimeId(), + false, url); } TEST_F(ExtensionEventRouterForwarderTest, @@ -208,7 +212,8 @@ TEST_F(ExtensionEventRouterForwarderTest, EXPECT_CALL(*event_router, CallExtensionEventRouter(profile2_, _, _, _, _, _)).Times(0); event_router->DispatchEventToRenderers(kEventName, kEventArgs, - profile1_, false, url); + profile1_->GetRuntimeId(), + false, url); } TEST_F(ExtensionEventRouterForwarderTest, BroadcastExtensionUI) { @@ -235,7 +240,8 @@ TEST_F(ExtensionEventRouterForwarderTest, UnicastExtensionUIRestricted) { EXPECT_CALL(*event_router, CallExtensionEventRouter(profile2_, _, _, _, _, _)).Times(0); event_router->DispatchEventToExtension(kExt, kEventName, kEventArgs, - profile1_, true, url); + profile1_->GetRuntimeId(), + true, url); } TEST_F(ExtensionEventRouterForwarderTest, UnicastExtensionUIUnrestricted) { @@ -249,5 +255,6 @@ TEST_F(ExtensionEventRouterForwarderTest, UnicastExtensionUIUnrestricted) { EXPECT_CALL(*event_router, CallExtensionEventRouter(profile2_, _, _, _, _, _)).Times(0); event_router->DispatchEventToExtension(kExt, kEventName, kEventArgs, - profile1_, false, url); + profile1_->GetRuntimeId(), + false, url); } diff --git a/chrome/browser/extensions/extension_io_event_router.cc b/chrome/browser/extensions/extension_io_event_router.cc deleted file mode 100644 index 2c9f234..0000000 --- a/chrome/browser/extensions/extension_io_event_router.cc +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/extension_io_event_router.h" - -#include "googleurl/src/gurl.h" -#include "chrome/browser/browser_thread.h" -#include "chrome/browser/extensions/extension_event_router.h" -#include "chrome/browser/profiles/profile.h" - -ExtensionIOEventRouter::ExtensionIOEventRouter(Profile* profile) - : profile_(profile) { -} - -ExtensionIOEventRouter::~ExtensionIOEventRouter() { -} - -void ExtensionIOEventRouter::DispatchEventToExtension( - const std::string& extension_id, - const std::string& event_name, - const std::string& event_args) const { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, - &ExtensionIOEventRouter::DispatchEventOnUIThread, - extension_id, event_name, event_args)); -} - -void ExtensionIOEventRouter::DispatchEventToRenderers( - const std::string& event_name, - const std::string& event_args, - const GURL& event_url) const { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, - &ExtensionIOEventRouter::DispatchEventToRenderersOnUIThread, - event_name, event_args, event_url)); -} - -void ExtensionIOEventRouter::DispatchEventOnUIThread( - const std::string& extension_id, - const std::string& event_name, - const std::string& event_args) const { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - - // If the profile has gone away, we're shutting down. If there's no event - // router, the extension system hasn't been initialized. - if (!profile_ || !profile_->GetExtensionEventRouter()) - return; - - profile_->GetExtensionEventRouter()->DispatchEventToExtension( - extension_id, event_name, event_args, profile_, GURL()); -} - -void ExtensionIOEventRouter::DispatchEventToRenderersOnUIThread( - const std::string& event_name, - const std::string& event_args, - const GURL& event_url) const { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - - // If the profile has gone away, we're shutting down. If there's no event - // router, the extension system hasn't been initialized. - if (!profile_ || !profile_->GetExtensionEventRouter()) - return; - - profile_->GetExtensionEventRouter()->DispatchEventToRenderers( - event_name, event_args, profile_, event_url); -} diff --git a/chrome/browser/extensions/extension_io_event_router.h b/chrome/browser/extensions/extension_io_event_router.h deleted file mode 100644 index 765b04d..0000000 --- a/chrome/browser/extensions/extension_io_event_router.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_ -#define CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_ -#pragma once - -#include <string> - -#include "base/ref_counted.h" - -class GURL; -class Profile; - -// For now, this just forwards events from the IO thread to the -// ExtensionEventRouter on the UI thread. -// TODO(mpcomplete): eventually I want this to have its own copy of the event -// listeners so it can bypass the jump to the UI thread. -class ExtensionIOEventRouter - : public base::RefCountedThreadSafe<ExtensionIOEventRouter> { - public: - explicit ExtensionIOEventRouter(Profile* profile); - ~ExtensionIOEventRouter(); - - void DestroyingProfile() { profile_ = NULL; } - - // Dispatch the named event to every extension listening to that event. - void DispatchEventToExtension(const std::string& extension_id, - const std::string& event_name, - const std::string& event_args) const; - - // Same as above, except the event is sent to all extensions that have - // sufficient permissions. - void DispatchEventToRenderers(const std::string& event_name, - const std::string& event_args, - const GURL& event_url) const; - - private: - void DispatchEventOnUIThread(const std::string& extension_id, - const std::string& event_name, - const std::string& event_args) const; - - void DispatchEventToRenderersOnUIThread( - const std::string& event_name, - const std::string& event_args, - const GURL& event_url) const; - - Profile* profile_; - - DISALLOW_COPY_AND_ASSIGN(ExtensionIOEventRouter); -}; - -#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_ diff --git a/chrome/browser/extensions/extension_proxy_api.cc b/chrome/browser/extensions/extension_proxy_api.cc index bc439eb..d4ed2f9 100644 --- a/chrome/browser/extensions/extension_proxy_api.cc +++ b/chrome/browser/extensions/extension_proxy_api.cc @@ -11,8 +11,7 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/prefs/proxy_config_dictionary.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/extensions/extension_io_event_router.h" +#include "chrome/browser/extensions/extension_event_router_forwarder.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/common/extensions/extension_error_utils.h" #include "chrome/common/pref_names.h" @@ -123,7 +122,8 @@ ExtensionProxyEventRouter::~ExtensionProxyEventRouter() { } void ExtensionProxyEventRouter::OnProxyError( - const ExtensionIOEventRouter* event_router, + ExtensionEventRouterForwarder* event_router, + ProfileId profile_id, int error_code) { ListValue args; DictionaryValue* dict = new DictionaryValue(); @@ -134,8 +134,14 @@ void ExtensionProxyEventRouter::OnProxyError( std::string json_args; base::JSONWriter::Write(&args, false, &json_args); - event_router->DispatchEventToRenderers( - kProxyEventOnProxyError, json_args, GURL()); + + if (profile_id != Profile::kInvalidProfileId) { + event_router->DispatchEventToRenderers( + kProxyEventOnProxyError, json_args, profile_id, true, GURL()); + } else { + event_router->BroadcastEventToRenderers( + kProxyEventOnProxyError, json_args, GURL()); + } } bool SetProxySettingsFunction::GetProxyServer( diff --git a/chrome/browser/extensions/extension_proxy_api.h b/chrome/browser/extensions/extension_proxy_api.h index cd21a00..178a814 100644 --- a/chrome/browser/extensions/extension_proxy_api.h +++ b/chrome/browser/extensions/extension_proxy_api.h @@ -10,10 +10,11 @@ #include "base/singleton.h" #include "chrome/browser/extensions/extension_function.h" #include "chrome/browser/extensions/extension_preference_api.h" +#include "chrome/browser/profiles/profile.h" #include "net/proxy/proxy_config.h" class DictionaryValue; -class ExtensionIOEventRouter; +class ExtensionEventRouterForwarder; // This class observes proxy error events and routes them to the appropriate // extensions listening to those events. All methods must be called on the IO @@ -22,7 +23,8 @@ class ExtensionProxyEventRouter { public: static ExtensionProxyEventRouter* GetInstance(); - void OnProxyError(const ExtensionIOEventRouter* event_router, + void OnProxyError(ExtensionEventRouterForwarder* event_router, + ProfileId profile_id, int error_code); private: diff --git a/chrome/browser/extensions/extension_webrequest_api.cc b/chrome/browser/extensions/extension_webrequest_api.cc index 8653e1d..1aa3f9e 100644 --- a/chrome/browser/extensions/extension_webrequest_api.cc +++ b/chrome/browser/extensions/extension_webrequest_api.cc @@ -9,7 +9,7 @@ #include "base/json/json_writer.h" #include "base/values.h" #include "chrome/browser/browser_thread.h" -#include "chrome/browser/extensions/extension_io_event_router.h" +#include "chrome/browser/extensions/extension_event_router_forwarder.h" #include "chrome/browser/extensions/extension_webrequest_api_constants.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_extent.h" @@ -209,9 +209,13 @@ void ExtensionWebRequestEventRouter::RemoveEventListenerOnUIThread( } void ExtensionWebRequestEventRouter::OnBeforeRequest( - const ExtensionIOEventRouter* event_router, + ExtensionEventRouterForwarder* event_router, + ProfileId profile_id, const GURL& url, const std::string& method) { + // TODO(jochen): Figure out what to do with events from the system context. + if (profile_id == Profile::kInvalidProfileId) + return; std::vector<const EventListener*> listeners = GetMatchingListeners(keys::kOnBeforeRequest, url); if (listeners.empty()) @@ -233,8 +237,10 @@ void ExtensionWebRequestEventRouter::OnBeforeRequest( for (std::vector<const EventListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) { + event_router->DispatchEventToExtension( - (*it)->extension_id, (*it)->sub_event_name, json_args); + (*it)->extension_id, (*it)->sub_event_name, json_args, + profile_id, true, GURL()); } } diff --git a/chrome/browser/extensions/extension_webrequest_api.h b/chrome/browser/extensions/extension_webrequest_api.h index 27fb5cb..f04edc9 100644 --- a/chrome/browser/extensions/extension_webrequest_api.h +++ b/chrome/browser/extensions/extension_webrequest_api.h @@ -14,8 +14,9 @@ #include "base/singleton.h" #include "ipc/ipc_message.h" #include "chrome/browser/extensions/extension_function.h" +#include "chrome/browser/profiles/profile.h" -class ExtensionIOEventRouter; +class ExtensionEventRouterForwarder; class GURL; // This class observes network events and routes them to the appropriate @@ -36,7 +37,8 @@ class ExtensionWebRequestEventRouter { // TODO(mpcomplete): additional params void OnBeforeRequest( - const ExtensionIOEventRouter* event_router, + ExtensionEventRouterForwarder* event_router, + ProfileId profile_id, const GURL& url, const std::string& method); diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 7839925..34c18ff 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -16,6 +16,8 @@ #include "base/string_util.h" #include "base/threading/thread_restrictions.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/extensions/extension_event_router_forwarder.h" +#include "chrome/browser/net/chrome_network_delegate.h" #include "chrome/browser/net/chrome_net_log.h" #include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/net/connect_interceptor.h" @@ -37,7 +39,6 @@ #include "net/base/host_resolver_impl.h" #include "net/base/mapped_host_resolver.h" #include "net/base/net_util.h" -#include "net/base/network_delegate.h" #include "net/http/http_auth_filter.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_network_layer.h" @@ -179,22 +180,6 @@ class LoggingNetworkChangeObserver DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver); }; -class SystemNetworkDelegate : public net::NetworkDelegate { - public: - SystemNetworkDelegate() {} - ~SystemNetworkDelegate() {} - - // NetworkDelegate methods: - // TODO(willchan): Implement these functions! - virtual void OnBeforeURLRequest(net::URLRequest* request) {} - virtual void OnSendHttpRequest(net::HttpRequestHeaders* headers) {} - virtual void OnResponseStarted(net::URLRequest* request) {} - virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) {} - - private: - DISALLOW_COPY_AND_ASSIGN(SystemNetworkDelegate); -}; - scoped_refptr<net::URLRequestContext> ConstructProxyScriptFetcherContext(IOThread::Globals* globals, net::NetLog* net_log) { @@ -210,7 +195,7 @@ ConstructProxyScriptFetcherContext(IOThread::Globals* globals, globals->proxy_script_fetcher_http_transaction_factory.get()); // In-memory cookie store. context->set_cookie_store(new net::CookieMonster(NULL, NULL)); - // TODO(mpcomplete): give it a SystemNetworkDelegate. + context->set_network_delegate(globals->system_network_delegate.get()); return context; } @@ -226,9 +211,13 @@ IOThread::Globals::~Globals() {} // |local_state| is passed in explicitly in order to (1) reduce implicit // dependencies and (2) make IOThread more flexible for testing. -IOThread::IOThread(PrefService* local_state, ChromeNetLog* net_log) +IOThread::IOThread( + PrefService* local_state, + ChromeNetLog* net_log, + ExtensionEventRouterForwarder* extension_event_router_forwarder) : BrowserProcessSubThread(BrowserThread::IO), net_log_(net_log), + extension_event_router_forwarder_(extension_event_router_forwarder), globals_(NULL), speculative_interceptor_(NULL), predictor_(NULL) { @@ -344,7 +333,10 @@ void IOThread::Init() { network_change_observer_.reset( new LoggingNetworkChangeObserver(net_log_)); - globals_->system_network_delegate.reset(new SystemNetworkDelegate); + globals_->extension_event_router_forwarder = + extension_event_router_forwarder_; + globals_->system_network_delegate.reset(new ChromeNetworkDelegate( + extension_event_router_forwarder_, Profile::kInvalidProfileId)); globals_->host_resolver.reset( CreateGlobalHostResolver(net_log_)); globals_->cert_verifier.reset(new net::CertVerifier); @@ -364,7 +356,6 @@ void IOThread::Init() { globals_->proxy_script_fetcher_proxy_service.get(); session_params.http_auth_handler_factory = globals_->http_auth_handler_factory.get(); - // TODO(willchan): Enable for proxy script fetcher context. session_params.network_delegate = globals_->system_network_delegate.get(); session_params.net_log = net_log_; session_params.ssl_config_service = globals_->ssl_config_service; diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index d0c58de..2352225 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h @@ -17,6 +17,7 @@ class ChromeNetLog; class ChromeURLRequestContextGetter; +class ExtensionEventRouterForwarder; class ListValue; class PrefService; @@ -57,10 +58,14 @@ class IOThread : public BrowserProcessSubThread { proxy_script_fetcher_http_transaction_factory; scoped_ptr<net::URLSecurityManager> url_security_manager; scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; + scoped_refptr<ExtensionEventRouterForwarder> + extension_event_router_forwarder; }; // |net_log| must either outlive the IOThread or be NULL. - IOThread(PrefService* local_state, ChromeNetLog* net_log); + IOThread(PrefService* local_state, + ChromeNetLog* net_log, + ExtensionEventRouterForwarder* extension_event_router_forwarder); virtual ~IOThread(); @@ -134,6 +139,10 @@ class IOThread : public BrowserProcessSubThread { // threads during shutdown, but is used most frequently on the IOThread. ChromeNetLog* net_log_; + // The ExtensionEventRouterForwarder allows for sending events to extensions + // from the IOThread. + ExtensionEventRouterForwarder* extension_event_router_forwarder_; + // These member variables are basically global, but their lifetimes are tied // to the IOThread. IOThread owns them all, despite not using scoped_ptr. // This is because the destructor of IOThread runs on the wrong thread. All diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc index 5452b96..59fb2e6 100644 --- a/chrome/browser/net/chrome_network_delegate.cc +++ b/chrome/browser/net/chrome_network_delegate.cc @@ -5,9 +5,9 @@ #include "chrome/browser/net/chrome_network_delegate.h" #include "base/logging.h" +#include "chrome/browser/extensions/extension_event_router_forwarder.h" #include "chrome/browser/extensions/extension_proxy_api.h" #include "chrome/browser/extensions/extension_webrequest_api.h" -#include "chrome/browser/net/chrome_url_request_context.h" #include "net/base/net_errors.h" #include "net/http/http_request_headers.h" #include "net/url_request/url_request.h" @@ -17,14 +17,15 @@ namespace { // If the |request| failed due to problems with a proxy, forward the error to // the proxy extension API. void ForwardProxyErrors(net::URLRequest* request, - ExtensionIOEventRouter* router) { + ExtensionEventRouterForwarder* event_router, + ProfileId profile_id) { if (request->status().status() == net::URLRequestStatus::FAILED) { switch (request->status().os_error()) { case net::ERR_PROXY_AUTH_UNSUPPORTED: case net::ERR_PROXY_CONNECTION_FAILED: case net::ERR_TUNNEL_CONNECTION_FAILED: ExtensionProxyEventRouter::GetInstance()->OnProxyError( - router, request->status().os_error()); + event_router, profile_id, request->status().os_error()); } } } @@ -32,16 +33,17 @@ void ForwardProxyErrors(net::URLRequest* request, } // namespace ChromeNetworkDelegate::ChromeNetworkDelegate( - ExtensionIOEventRouter* extension_io_event_router) - : extension_io_event_router_(extension_io_event_router) { - DCHECK(extension_io_event_router); + ExtensionEventRouterForwarder* event_router, + ProfileId profile_id) + : event_router_(event_router), + profile_id_(profile_id) { } ChromeNetworkDelegate::~ChromeNetworkDelegate() {} void ChromeNetworkDelegate::OnBeforeURLRequest(net::URLRequest* request) { ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRequest( - extension_io_event_router_, request->url(), request->method()); + event_router_.get(), profile_id_, request->url(), request->method()); } void ChromeNetworkDelegate::OnSendHttpRequest( @@ -50,10 +52,10 @@ void ChromeNetworkDelegate::OnSendHttpRequest( } void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { - ForwardProxyErrors(request, extension_io_event_router_); + ForwardProxyErrors(request, event_router_.get(), profile_id_); } void ChromeNetworkDelegate::OnReadCompleted(net::URLRequest* request, int bytes_read) { - ForwardProxyErrors(request, extension_io_event_router_); + ForwardProxyErrors(request, event_router_.get(), profile_id_); } diff --git a/chrome/browser/net/chrome_network_delegate.h b/chrome/browser/net/chrome_network_delegate.h index fbac036..5b3fb15 100644 --- a/chrome/browser/net/chrome_network_delegate.h +++ b/chrome/browser/net/chrome_network_delegate.h @@ -7,17 +7,22 @@ #pragma once #include "base/basictypes.h" +#include "base/ref_counted.h" +#include "chrome/browser/profiles/profile.h" #include "net/base/network_delegate.h" -class ExtensionIOEventRouter; +class ExtensionEventRouterForwarder; // ChromeNetworkDelegate is the central point from within the chrome code to // add hooks into the network stack. class ChromeNetworkDelegate : public net::NetworkDelegate { public: + // If |profile| is NULL, events will be broadcasted to all profiles, + // otherwise, they will be only send to the specified profile. explicit ChromeNetworkDelegate( - ExtensionIOEventRouter* extension_io_event_router); - ~ChromeNetworkDelegate(); + ExtensionEventRouterForwarder* event_router, + ProfileId profile_id); + virtual ~ChromeNetworkDelegate(); private: // NetworkDelegate methods: @@ -26,7 +31,8 @@ class ChromeNetworkDelegate : public net::NetworkDelegate { virtual void OnResponseStarted(net::URLRequest* request); virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); - ExtensionIOEventRouter* const extension_io_event_router_; + scoped_refptr<ExtensionEventRouterForwarder> event_router_; + const ProfileId profile_id_; DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); }; 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); diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index ac85555..a85f57d 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -968,8 +968,6 @@ 'browser/extensions/extension_input_api.h', 'browser/extensions/extension_install_ui.cc', 'browser/extensions/extension_install_ui.h', - 'browser/extensions/extension_io_event_router.cc', - 'browser/extensions/extension_io_event_router.h', 'browser/extensions/extension_management_api.cc', 'browser/extensions/extension_management_api.h', 'browser/extensions/extension_menu_manager.cc', diff --git a/chrome/test/testing_browser_process.cc b/chrome/test/testing_browser_process.cc index f6af58f..adb2b10 100644 --- a/chrome/test/testing_browser_process.cc +++ b/chrome/test/testing_browser_process.cc @@ -117,6 +117,11 @@ ui::Clipboard* TestingBrowserProcess::clipboard() { return clipboard_.get(); } +ExtensionEventRouterForwarder* +TestingBrowserProcess::extension_event_router_forwarder() { + return NULL; +} + NotificationUIManager* TestingBrowserProcess::notification_ui_manager() { return NULL; } diff --git a/chrome/test/testing_browser_process.h b/chrome/test/testing_browser_process.h index d544f82..f302458 100644 --- a/chrome/test/testing_browser_process.h +++ b/chrome/test/testing_browser_process.h @@ -79,6 +79,8 @@ class TestingBrowserProcess : public BrowserProcess { virtual ui::Clipboard* clipboard(); + virtual ExtensionEventRouterForwarder* extension_event_router_forwarder(); + virtual NotificationUIManager* notification_ui_manager(); virtual GoogleURLTracker* google_url_tracker(); diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc index 1458d4a..479cf70 100644 --- a/chrome/test/testing_profile.cc +++ b/chrome/test/testing_profile.cc @@ -432,10 +432,6 @@ ExtensionEventRouter* TestingProfile::GetExtensionEventRouter() { return NULL; } -ExtensionIOEventRouter* TestingProfile::GetExtensionIOEventRouter() { - return NULL; -} - ExtensionSpecialStoragePolicy* TestingProfile::GetExtensionSpecialStoragePolicy() { if (!extension_special_storage_policy_) diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h index 5517553..53bcb89 100644 --- a/chrome/test/testing_profile.h +++ b/chrome/test/testing_profile.h @@ -153,7 +153,6 @@ class TestingProfile : public Profile { virtual ExtensionProcessManager* GetExtensionProcessManager(); virtual ExtensionMessageService* GetExtensionMessageService(); virtual ExtensionEventRouter* GetExtensionEventRouter(); - virtual ExtensionIOEventRouter* GetExtensionIOEventRouter(); virtual ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy(); virtual SSLHostState* GetSSLHostState(); virtual net::TransportSecurityState* GetTransportSecurityState(); diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc index e3efa82..1759fc0 100644 --- a/content/browser/browsing_instance.cc +++ b/content/browser/browsing_instance.cc @@ -57,7 +57,7 @@ BrowsingInstance::SiteInstanceMap* BrowsingInstance::GetSiteInstanceMap( // Otherwise, process-per-site is in use, at least for this URL. Look up the // global map for this profile, creating an entry if necessary. ProfileId runtime_id = profile ? profile->GetRuntimeId() - : Profile::InvalidProfileId; + : Profile::kInvalidProfileId; return &profile_site_instance_map_[runtime_id]; } @@ -124,7 +124,7 @@ void BrowsingInstance::UnregisterSiteInstance(SiteInstance* site_instance) { if (!RemoveSiteInstanceFromMap(&site_instance_map_, site, site_instance)) { // Wasn't in our local map, so look in the static per-profile map. ProfileId runtime_id = profile_ ? profile_->GetRuntimeId() - : Profile::InvalidProfileId; + : Profile::kInvalidProfileId; RemoveSiteInstanceFromMap( &profile_site_instance_map_[runtime_id], site, site_instance); } |