Commit 6691c197 authored by mgiuca@chromium.org's avatar mgiuca@chromium.org

AppWindowContents: Clean up unnecessary SuspendRenderViewHost.

This is no longer necessary since crbug.com/123007 was fixed.

BUG=123007

Review URL: https://codereview.chromium.org/378193002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284866 0039d316-1c4b-4281-b951-d872f2087c98
parent 4162ae8a
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "chrome/common/extensions/api/app_window.h" #include "chrome/common/extensions/api/app_window.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.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_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/resource_dispatcher_host.h"
...@@ -41,7 +39,7 @@ void AppWindowContentsImpl::Initialize(content::BrowserContext* context, ...@@ -41,7 +39,7 @@ void AppWindowContentsImpl::Initialize(content::BrowserContext* context,
content::WebContents::Create(content::WebContents::CreateParams( content::WebContents::Create(content::WebContents::CreateParams(
context, content::SiteInstance::CreateForURL(context, url_)))); context, content::SiteInstance::CreateForURL(context, url_))));
content::WebContentsObserver::Observe(web_contents_.get()); Observe(web_contents_.get());
web_contents_->GetMutableRendererPrefs()-> web_contents_->GetMutableRendererPrefs()->
browser_handles_all_top_level_requests = true; browser_handles_all_top_level_requests = true;
web_contents_->GetRenderViewHost()->SyncRendererPrefs(); web_contents_->GetRenderViewHost()->SyncRendererPrefs();
...@@ -61,20 +59,9 @@ void AppWindowContentsImpl::LoadContents(int32 creator_process_id) { ...@@ -61,20 +59,9 @@ void AppWindowContentsImpl::LoadContents(int32 creator_process_id) {
<< ") != creator (" << creator_process_id << "). Routing disabled."; << ") != creator (" << creator_process_id << "). Routing disabled.";
} }
// TODO(jeremya): there's a bug where navigating a web contents to an
// extension URL causes it to create a new RVH and discard the old (perfectly
// usable) one. To work around this, we watch for a
// NOTIFICATION_RENDER_VIEW_HOST_CHANGED message from the web contents (which
// will be sent during LoadURL) and suspend resource requests on the new RVH
// to ensure that we block the new RVH from loading anything. It should be
// okay to remove the NOTIFICATION_RENDER_VIEW_HOST_CHANGED registration once
// http://crbug.com/123007 is fixed.
registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
content::Source<content::WebContents>(web_contents()));
web_contents_->GetController().LoadURL( web_contents_->GetController().LoadURL(
url_, content::Referrer(), content::PAGE_TRANSITION_LINK, url_, content::Referrer(), content::PAGE_TRANSITION_LINK,
std::string()); std::string());
registrar_.RemoveAll();
} }
void AppWindowContentsImpl::NativeWindowChanged( void AppWindowContentsImpl::NativeWindowChanged(
...@@ -113,27 +100,6 @@ content::WebContents* AppWindowContentsImpl::GetWebContents() const { ...@@ -113,27 +100,6 @@ content::WebContents* AppWindowContentsImpl::GetWebContents() const {
return web_contents_.get(); return web_contents_.get();
} }
void AppWindowContentsImpl::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED: {
// TODO(jeremya): once http://crbug.com/123007 is fixed, we'll no longer
// need to suspend resource requests here (the call in the constructor
// should be enough).
content::Details<std::pair<content::RenderViewHost*,
content::RenderViewHost*> >
host_details(details);
if (host_details->first)
SuspendRenderViewHost(host_details->second);
break;
}
default:
NOTREACHED() << "Received unexpected notification";
}
}
bool AppWindowContentsImpl::OnMessageReceived(const IPC::Message& message) { bool AppWindowContentsImpl::OnMessageReceived(const IPC::Message& message) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AppWindowContentsImpl, message) IPC_BEGIN_MESSAGE_MAP(AppWindowContentsImpl, message)
......
...@@ -5,16 +5,13 @@ ...@@ -5,16 +5,13 @@
#ifndef APPS_APP_WINDOW_CONTENTS_H_ #ifndef APPS_APP_WINDOW_CONTENTS_H_
#define APPS_APP_WINDOW_CONTENTS_H_ #define APPS_APP_WINDOW_CONTENTS_H_
#include <vector>
#include "apps/app_window.h" #include "apps/app_window.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_observer.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "extensions/browser/extension_function_dispatcher.h" #include "extensions/browser/extension_function_dispatcher.h"
#include "url/gurl.h"
class GURL;
namespace content { namespace content {
class BrowserContext; class BrowserContext;
...@@ -31,7 +28,6 @@ namespace apps { ...@@ -31,7 +28,6 @@ namespace apps {
// messages to the extensions system. // messages to the extensions system.
class AppWindowContentsImpl class AppWindowContentsImpl
: public AppWindowContents, : public AppWindowContents,
public content::NotificationObserver,
public content::WebContentsObserver, public content::WebContentsObserver,
public extensions::ExtensionFunctionDispatcher::Delegate { public extensions::ExtensionFunctionDispatcher::Delegate {
public: public:
...@@ -48,11 +44,6 @@ class AppWindowContentsImpl ...@@ -48,11 +44,6 @@ class AppWindowContentsImpl
virtual content::WebContents* GetWebContents() const OVERRIDE; virtual content::WebContents* GetWebContents() const OVERRIDE;
private: private:
// content::NotificationObserver
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
// content::WebContentsObserver // content::WebContentsObserver
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
...@@ -68,7 +59,6 @@ class AppWindowContentsImpl ...@@ -68,7 +59,6 @@ class AppWindowContentsImpl
AppWindow* host_; // This class is owned by |host_| AppWindow* host_; // This class is owned by |host_|
GURL url_; GURL url_;
content::NotificationRegistrar registrar_;
scoped_ptr<content::WebContents> web_contents_; scoped_ptr<content::WebContents> web_contents_;
scoped_ptr<extensions::ExtensionFunctionDispatcher> scoped_ptr<extensions::ExtensionFunctionDispatcher>
extension_function_dispatcher_; extension_function_dispatcher_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment