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

Unified Diff: chrome/browser/printing/print_preview_tab_controller.cc

Issue 10890023: Miscellaneous cleanups from several months ago I never got around to landing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/printing/background_printing_manager.cc ('k') | chrome/browser/sessions/session_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_preview_tab_controller.cc
===================================================================
--- chrome/browser/printing/print_preview_tab_controller.cc (revision 154486)
+++ chrome/browser/printing/print_preview_tab_controller.cc (working copy)
@@ -279,30 +279,17 @@
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- switch (type) {
- case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: {
- OnRendererProcessClosed(
- content::Source<content::RenderProcessHost>(source).ptr());
- break;
- }
- case chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED: {
- OnTabContentsDestroyed(content::Source<TabContents>(source).ptr());
- break;
- }
- case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
- NavigationController* controller =
- content::Source<NavigationController>(source).ptr();
- TabContents* tab = TabContents::FromWebContents(
- controller->GetWebContents());
- content::LoadCommittedDetails* load_details =
- content::Details<content::LoadCommittedDetails>(details).ptr();
- OnNavEntryCommitted(tab, load_details);
- break;
- }
- default: {
- NOTREACHED();
- break;
- }
+ if (type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED) {
+ OnRendererProcessClosed(
+ content::Source<content::RenderProcessHost>(source).ptr());
+ } else if (type == chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED) {
+ OnTabContentsDestroyed(content::Source<TabContents>(source).ptr());
+ } else {
+ DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type);
+ TabContents* tab = TabContents::FromWebContents(
+ content::Source<NavigationController>(source)->GetWebContents());
+ OnNavEntryCommitted(tab,
+ content::Details<content::LoadCommittedDetails>(details).ptr());
}
}
@@ -471,42 +458,38 @@
}
void PrintPreviewTabController::AddObservers(TabContents* tab) {
- WebContents* contents = tab->web_contents();
+ WebContents* web_contents = tab->web_contents();
registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED,
content::Source<TabContents>(tab));
- registrar_.Add(
- this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::Source<NavigationController>(&contents->GetController()));
+ registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ content::Source<NavigationController>(&web_contents->GetController()));
// Multiple sites may share the same RenderProcessHost, so check if this
// notification has already been added.
- content::RenderProcessHost* rph = tab->web_contents()->GetRenderProcessHost();
+ content::Source<content::RenderProcessHost> rph_source(
+ web_contents->GetRenderProcessHost());
if (!registrar_.IsRegistered(this,
- content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
- content::Source<content::RenderProcessHost>(
- rph))) {
+ content::NOTIFICATION_RENDERER_PROCESS_CLOSED, rph_source)) {
registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
- content::Source<content::RenderProcessHost>(rph));
+ rph_source);
}
}
void PrintPreviewTabController::RemoveObservers(TabContents* tab) {
- WebContents* contents = tab->web_contents();
+ WebContents* web_contents = tab->web_contents();
registrar_.Remove(this, chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED,
content::Source<TabContents>(tab));
- registrar_.Remove(
- this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::Source<NavigationController>(&contents->GetController()));
+ registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ content::Source<NavigationController>(&web_contents->GetController()));
// Multiple sites may share the same RenderProcessHost, so check if this
// notification has already been added.
- content::RenderProcessHost* rph = tab->web_contents()->GetRenderProcessHost();
+ content::Source<content::RenderProcessHost> rph_source(
+ web_contents->GetRenderProcessHost());
if (registrar_.IsRegistered(this,
- content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
- content::Source<content::RenderProcessHost>(
- rph))) {
+ content::NOTIFICATION_RENDERER_PROCESS_CLOSED, rph_source)) {
registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
- content::Source<content::RenderProcessHost>(rph));
+ rph_source);
}
}
« no previous file with comments | « chrome/browser/printing/background_printing_manager.cc ('k') | chrome/browser/sessions/session_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698