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

Side by Side Diff: chrome/browser/ui/webui/print_preview_handler.h

Issue 7202012: Print Preview: Display a throbber when the user requests the system print (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/webui.css ('k') | chrome/browser/ui/webui/print_preview_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/printing/print_view_manager_observer.h"
11 #include "chrome/browser/ui/shell_dialogs.h" 12 #include "chrome/browser/ui/shell_dialogs.h"
12 #include "content/browser/webui/web_ui.h" 13 #include "content/browser/webui/web_ui.h"
13 14
14 class FilePath; 15 class FilePath;
15 class FundamentalValue; 16 class FundamentalValue;
16 class PrintSystemTaskProxy; 17 class PrintSystemTaskProxy;
17 class StringValue; 18 class StringValue;
18 19
19 namespace printing { 20 namespace printing {
20 class PrintBackend; 21 class PrintBackend;
21 } 22 }
22 23
23 // The handler for Javascript messages related to the "print preview" dialog. 24 // The handler for Javascript messages related to the print preview dialog.
24 class PrintPreviewHandler : public WebUIMessageHandler, 25 class PrintPreviewHandler : public WebUIMessageHandler,
25 public base::SupportsWeakPtr<PrintPreviewHandler>, 26 public base::SupportsWeakPtr<PrintPreviewHandler>,
26 public SelectFileDialog::Listener { 27 public SelectFileDialog::Listener,
28 public printing::PrintViewManagerObserver {
27 public: 29 public:
28 PrintPreviewHandler(); 30 PrintPreviewHandler();
29 virtual ~PrintPreviewHandler(); 31 virtual ~PrintPreviewHandler();
30 32
31 // WebUIMessageHandler implementation. 33 // WebUIMessageHandler implementation.
32 virtual void RegisterMessages(); 34 virtual void RegisterMessages();
33 35
34 // SelectFileDialog::Listener implementation. 36 // SelectFileDialog::Listener implementation.
35 virtual void FileSelected(const FilePath& path, int index, void* params); 37 virtual void FileSelected(const FilePath& path, int index, void* params);
36 virtual void FileSelectionCanceled(void* params); 38 virtual void FileSelectionCanceled(void* params);
37 39
40 // PrintViewManagerObserver implementation.
41 virtual void OnPrintDialogShown();
42
38 // Displays a modal dialog, prompting the user to select a file. 43 // Displays a modal dialog, prompting the user to select a file.
39 void SelectFile(const FilePath& default_path); 44 void SelectFile(const FilePath& default_path);
40 45
46 // Called when the print preview tab navigates. This is the last time this
47 // this object has access to the PrintViewManager in order to disconnect the
48 // observer.
49 void OnNavigation();
50
41 private: 51 private:
42 friend class PrintSystemTaskProxy; 52 friend class PrintSystemTaskProxy;
43 53
44 TabContents* preview_tab(); 54 TabContents* preview_tab();
45 55
46 // Get the default printer. |args| is unused. 56 // Get the default printer. |args| is unused.
47 void HandleGetDefaultPrinter(const ListValue* args); 57 void HandleGetDefaultPrinter(const ListValue* args);
48 58
49 // Get the list of printers. |args| is unused. 59 // Get the list of printers. |args| is unused.
50 void HandleGetPrinters(const ListValue* args); 60 void HandleGetPrinters(const ListValue* args);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Whether we have already logged a failed print preview. 138 // Whether we have already logged a failed print preview.
129 bool reported_failed_preview_; 139 bool reported_failed_preview_;
130 140
131 // Whether we have already logged the number of printers this session. 141 // Whether we have already logged the number of printers this session.
132 bool has_logged_printers_count_; 142 bool has_logged_printers_count_;
133 143
134 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 144 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
135 }; 145 };
136 146
137 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 147 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/webui.css ('k') | chrome/browser/ui/webui/print_preview_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698