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

Side by Side Diff: chrome/browser/ui/webui/print_preview_ui.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
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_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/printing/print_preview_data_service.h" 14 #include "chrome/browser/printing/print_preview_data_service.h"
15 #include "chrome/browser/ui/webui/chrome_web_ui.h" 15 #include "chrome/browser/ui/webui/chrome_web_ui.h"
16 16
17 class PrintPreviewDataService; 17 class PrintPreviewDataService;
18 class PrintPreviewHandler;
18 19
19 class PrintPreviewUI : public ChromeWebUI { 20 class PrintPreviewUI : public ChromeWebUI {
20 public: 21 public:
21 explicit PrintPreviewUI(TabContents* contents); 22 explicit PrintPreviewUI(TabContents* contents);
22 virtual ~PrintPreviewUI(); 23 virtual ~PrintPreviewUI();
23 24
24 // Gets the print preview |data|. The data is valid as long as the 25 // Gets the print preview |data|. The data is valid as long as the
25 // PrintPreviewDataService is valid and SetPrintPreviewData() does not get 26 // PrintPreviewDataService is valid and SetPrintPreviewData() does not get
26 // called. 27 // called.
27 void GetPrintPreviewData(scoped_refptr<RefCountedBytes>* data); 28 void GetPrintPreviewData(scoped_refptr<RefCountedBytes>* data);
28 29
29 // Sets the print preview |data|. 30 // Sets the print preview |data|.
30 void SetPrintPreviewData(const RefCountedBytes* data); 31 void SetPrintPreviewData(const RefCountedBytes* data);
31 32
32 // Notify the Web UI renderer that preview data is available. 33 // Notify the Web UI renderer that preview data is available.
33 // |expected_pages_count| specifies the total number of pages. 34 // |expected_pages_count| specifies the total number of pages.
34 // |job_title| is the title of the page being previewed. 35 // |job_title| is the title of the page being previewed.
35 // |modifiable| indicates if the preview can be rerendered with different 36 // |modifiable| indicates if the preview can be rerendered with different
36 // print settings. 37 // print settings.
37 void OnPreviewDataIsAvailable(int expected_pages_count, 38 void OnPreviewDataIsAvailable(int expected_pages_count,
38 const string16& job_title, 39 const string16& job_title,
39 bool modifiable); 40 bool modifiable);
40 41
42 // Notify the Web UI that a navigation has occurred in this tab. This is the
43 // last chance to communicate with the source tab before the assocation is
44 // erased.
45 void OnNavigation();
46
41 // Notify the Web UI that initiator tab is closed, so we can disable all 47 // Notify the Web UI that initiator tab is closed, so we can disable all
42 // the controls that need the initiator tab for generating the preview data. 48 // the controls that need the initiator tab for generating the preview data.
43 // |initiator_tab_url| is passed in order to display a more accurate error 49 // |initiator_tab_url| is passed in order to display a more accurate error
44 // message. 50 // message.
45 void OnInitiatorTabClosed(const std::string& initiator_tab_url); 51 void OnInitiatorTabClosed(const std::string& initiator_tab_url);
46 52
47 // Notify the Web UI renderer that file selection has been cancelled. 53 // Notify the Web UI renderer that file selection has been cancelled.
48 void OnFileSelectionCancelled(); 54 void OnFileSelectionCancelled();
49 55
50 private: 56 private:
51 // Helper function 57 // Helper function
52 PrintPreviewDataService* print_preview_data_service(); 58 PrintPreviewDataService* print_preview_data_service();
53 59
54 base::TimeTicks initial_preview_start_time_; 60 base::TimeTicks initial_preview_start_time_;
55 61
56 // Store the PrintPreviewUI address string. 62 // Store the PrintPreviewUI address string.
57 std::string preview_ui_addr_str_; 63 std::string preview_ui_addr_str_;
58 64
65 // Weak pointer to the WebUI handler.
66 PrintPreviewHandler* handler_;
67
59 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); 68 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI);
60 }; 69 };
61 70
62 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_ 71 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | chrome/browser/ui/webui/print_preview_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698