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

Unified Diff: chrome/browser/printing/background_printing_manager.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
Index: chrome/browser/printing/background_printing_manager.cc
===================================================================
--- chrome/browser/printing/background_printing_manager.cc (revision 153800)
+++ chrome/browser/printing/background_printing_manager.cc (working copy)
@@ -57,14 +57,12 @@
//
// Multiple sites may share the same RenderProcessHost, so check if this
// notification has already been added.
- content::RenderProcessHost* rph =
- preview_tab->web_contents()->GetRenderProcessHost();
+ content::Source<content::RenderProcessHost> rph_source(
+ preview_tab->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);
}
// Activate the initiator tab.
@@ -83,24 +81,14 @@
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_PRINT_JOB_RELEASED: {
- OnPrintJobReleased(content::Source<TabContents>(source).ptr());
- break;
- }
- case chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED: {
- OnTabContentsDestroyed(content::Source<TabContents>(source).ptr());
- break;
- }
- default: {
- NOTREACHED();
- break;
- }
+ if (type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED) {
+ OnRendererProcessClosed(
+ content::Source<content::RenderProcessHost>(source).ptr());
+ } else if (type == chrome::NOTIFICATION_PRINT_JOB_RELEASED) {
+ OnPrintJobReleased(content::Source<TabContents>(source).ptr());
+ } else {
+ DCHECK_EQ(chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, type);
+ OnTabContentsDestroyed(content::Source<TabContents>(source).ptr());
}
}

Powered by Google App Engine
This is Rietveld 408576698