Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Unified Diff: chrome/browser/ui/panels/panel.cc

Issue 1132163004: Remove NOTIFICATION_RENDER_VIEW_HOST_CHANGED. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | content/browser/frame_host/render_frame_host_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel.cc
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index 949c612a845b03667f95e7eda74920108d6feaf2..7c98b7d6853a6be89288048db11cf6578a27e107 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -437,9 +437,6 @@ void Panel::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED:
- ConfigureAutoResize(content::Source<content::WebContents>(source).ptr());
- break;
case chrome::NOTIFICATION_APP_TERMINATING:
Close();
break;
@@ -448,6 +445,11 @@ void Panel::Observe(int type,
}
}
+void Panel::RenderViewHostChanged(content::RenderViewHost* old_host,
+ content::RenderViewHost* new_host) {
+ ConfigureAutoResize(web_contents());
+}
+
void Panel::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension,
@@ -593,8 +595,7 @@ void Panel::SetAutoResizable(bool resizable) {
EnableWebContentsAutoResize(web_contents);
} else {
if (web_contents) {
- registrar_.Remove(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
- content::Source<content::WebContents>(web_contents));
+ content::WebContentsObserver::Observe(nullptr);
// NULL might be returned if the tab has not been added.
RenderViewHost* render_view_host = web_contents->GetRenderViewHost();
@@ -610,14 +611,7 @@ void Panel::EnableWebContentsAutoResize(content::WebContents* web_contents) {
// We also need to know when the render view host changes in order
// to turn on auto-resize notifications in the new render view host.
- if (!registrar_.IsRegistered(
- this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
- content::Source<content::WebContents>(web_contents))) {
- registrar_.Add(
- this,
- content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
- content::Source<content::WebContents>(web_contents));
- }
+ content::WebContentsObserver::Observe(web_contents);
}
void Panel::OnContentsAutoResized(const gfx::Size& new_content_size) {
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | content/browser/frame_host/render_frame_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698