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

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

Issue 10911351: Switch PrintViewManager, PrintPreviewMessageHandler to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix typo Created 8 years, 3 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/print_preview_message_handler.h
diff --git a/chrome/browser/printing/print_preview_message_handler.h b/chrome/browser/printing/print_preview_message_handler.h
index 2a776b470219c3552cf5585f2ff08dbebbdac65a..b1340f37b54c827e78306159878e374cb38cbed2 100644
--- a/chrome/browser/printing/print_preview_message_handler.h
+++ b/chrome/browser/printing/print_preview_message_handler.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
#include "base/compiler_specific.h"
+#include "chrome/browser/tab_contents/web_contents_user_data.h"
#include "content/public/browser/web_contents_observer.h"
class PrintPreviewUI;
@@ -22,24 +23,24 @@ namespace printing {
struct PageSizeMargins;
-// TabContents offloads print preview message handling to
-// PrintPreviewMessageHandler. This object has the same life time as the
-// TabContents that owns it.
-class PrintPreviewMessageHandler : public content::WebContentsObserver {
+// Manages the print preview handling for a WebContents.
+class PrintPreviewMessageHandler
+ : public content::WebContentsObserver,
+ public WebContentsUserData<PrintPreviewMessageHandler> {
public:
- explicit PrintPreviewMessageHandler(content::WebContents* web_contents);
virtual ~PrintPreviewMessageHandler();
// content::WebContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
private:
+ explicit PrintPreviewMessageHandler(content::WebContents* web_contents);
+ static int kUserDataKey;
+ friend class WebContentsUserData<PrintPreviewMessageHandler>;
+
// Gets the print preview tab associated with the WebContents being observed.
TabContents* GetPrintPreviewTab();
- // Helper function to return the TabContents for web_contents().
- TabContents* tab_contents();
-
// Gets the PrintPreviewUI associated with the WebContents being observed.
PrintPreviewUI* GetPrintPreviewUI();
« no previous file with comments | « chrome/browser/automation/automation_provider_win.cc ('k') | chrome/browser/printing/print_preview_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698