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

Unified Diff: chrome/browser/printing/print_preview_dialog_controller.h

Issue 124673002: Remove notifications from PrintPreviewDialogController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 11 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 | « no previous file | chrome/browser/printing/print_preview_dialog_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_preview_dialog_controller.h
diff --git a/chrome/browser/printing/print_preview_dialog_controller.h b/chrome/browser/printing/print_preview_dialog_controller.h
index 98b2ec8b080ff585343b51705d4187893210ba80..90b7ca69982066704d96d19d59055168914e03bf 100644
--- a/chrome/browser/printing/print_preview_dialog_controller.h
+++ b/chrome/browser/printing/print_preview_dialog_controller.h
@@ -5,12 +5,10 @@
#ifndef CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_
#define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_
-#include <map>
+#include <vector>
#include "base/memory/ref_counted.h"
#include "chrome/browser/sessions/session_id.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
class GURL;
@@ -26,11 +24,10 @@ namespace printing {
// the initiator, and the constrained dialog that shows the print preview is the
// print preview dialog.
// This class manages print preview dialog creation and destruction, and keeps
-// track of the 1:1 relationship between initiatora tabs and print preview
+// track of the 1:1 relationship between initiator tabs and print preview
// dialogs.
class PrintPreviewDialogController
- : public base::RefCounted<PrintPreviewDialogController>,
- public content::NotificationObserver {
+ : public base::RefCounted<PrintPreviewDialogController> {
public:
PrintPreviewDialogController();
@@ -55,11 +52,6 @@ class PrintPreviewDialogController
// Returns NULL if no initiator exists for |preview_dialog|.
content::WebContents* GetInitiator(content::WebContents* preview_dialog);
- // content::NotificationObserver implementation.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
// Returns true if |contents| is a print preview dialog.
static bool IsPrintPreviewDialog(content::WebContents* contents);
@@ -75,27 +67,15 @@ class PrintPreviewDialogController
private:
friend class base::RefCounted<PrintPreviewDialogController>;
-
- // 1:1 relationship between a print preview dialog and its initiator tab.
- // Key: Print preview dialog.
- // Value: Initiator.
- typedef std::map<content::WebContents*, content::WebContents*>
- PrintPreviewDialogMap;
+ struct Operation;
virtual ~PrintPreviewDialogController();
- // Handler for the RENDERER_PROCESS_CLOSED notification. This is observed when
- // the initiator renderer crashed.
- void OnRendererProcessClosed(content::RenderProcessHost* rph);
-
- // Handler for the WEB_CONTENTS_DESTROYED notification. This is observed when
- // either WebContents is closed.
+ // Handlers for observed events.
+ void OnRenderProcessExited(content::RenderProcessHost* rph);
void OnWebContentsDestroyed(content::WebContents* contents);
-
- // Handler for the NAV_ENTRY_COMMITTED notification. This is observed when the
- // renderer is navigated to a different page.
- void OnNavEntryCommitted(content::WebContents* contents,
- content::LoadCommittedDetails* details);
+ void OnNavigationEntryCommitted(content::WebContents* contents,
+ const content::LoadCommittedDetails* details);
// Creates a new print preview dialog.
content::WebContents* CreatePrintPreviewDialog(
@@ -105,19 +85,12 @@ class PrintPreviewDialogController
// |preview_dialog| in |preview_dialog|'s PrintPreviewUI.
void SaveInitiatorTitle(content::WebContents* preview_dialog);
- // Adds/Removes observers for notifications from |contents|.
- void AddObservers(content::WebContents* contents);
- void RemoveObservers(content::WebContents* contents);
-
// Removes WebContents when they close/crash/navigate.
void RemoveInitiator(content::WebContents* initiator);
void RemovePreviewDialog(content::WebContents* preview_dialog);
- // Mapping between print preview dialog and the corresponding initiator.
- PrintPreviewDialogMap preview_dialog_map_;
-
- // A registrar for listening notifications.
- content::NotificationRegistrar registrar_;
+ // The list of the currently active preview operations.
+ std::vector<Operation*> preview_operations_;
// True if the controller is waiting for a new preview dialog via
// content::NAVIGATION_TYPE_NEW_PAGE.
« no previous file with comments | « no previous file | chrome/browser/printing/print_preview_dialog_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698