| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PRINT_PREVIEW_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 13 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 14 | 14 |
| 15 class PrintPreviewDataService; | 15 class PrintPreviewDataService; |
| 16 class PrintPreviewHandler; | 16 class PrintPreviewHandler; |
| 17 struct PrintHostMsg_DidGetPreviewPageCount_Params; | 17 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
| 18 struct PrintHostMsg_RequestPrintPreview_Params; |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class RefCountedBytes; | 21 class RefCountedBytes; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace gfx { | 24 namespace gfx { |
| 24 class Rect; | 25 class Rect; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace printing { | 28 namespace printing { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 53 | 54 |
| 54 // Setters | 55 // Setters |
| 55 void SetInitiatorTabTitle(const string16& initiator_tab_title); | 56 void SetInitiatorTabTitle(const string16& initiator_tab_title); |
| 56 | 57 |
| 57 string16 initiator_tab_title() { return initiator_tab_title_; } | 58 string16 initiator_tab_title() { return initiator_tab_title_; } |
| 58 | 59 |
| 59 bool source_is_modifiable() { return source_is_modifiable_; } | 60 bool source_is_modifiable() { return source_is_modifiable_; } |
| 60 | 61 |
| 61 bool source_has_selection() { return source_has_selection_; } | 62 bool source_has_selection() { return source_has_selection_; } |
| 62 | 63 |
| 63 // Set |source_is_modifiable_| for |print_preview_dialog|'s PrintPreviewUI. | 64 bool print_selection_only() { return print_selection_only_; } |
| 64 static void SetSourceIsModifiable(content::WebContents* print_preview_dialog, | |
| 65 bool source_is_modifiable); | |
| 66 | 65 |
| 67 // Set |source_has_selection_| for |print_preview_dialog|'s PrintPreviewUI. | 66 // Set initial settings for PrintPreviewUI. |
| 68 static void SetSourceHasSelection(content::WebContents* print_preview_dialog, | 67 static void SetInitialParams( |
| 69 bool source_has_selection); | 68 content::WebContents* print_preview_dialog, |
| 69 const PrintHostMsg_RequestPrintPreview_Params& params); |
| 70 | 70 |
| 71 // Determines whether to cancel a print preview request based on | 71 // Determines whether to cancel a print preview request based on |
| 72 // |preview_ui_id| and |request_id|. | 72 // |preview_ui_id| and |request_id|. |
| 73 // Can be called from any thread. | 73 // Can be called from any thread. |
| 74 static void GetCurrentPrintPreviewStatus(int32 preview_ui_id, | 74 static void GetCurrentPrintPreviewStatus(int32 preview_ui_id, |
| 75 int request_id, | 75 int request_id, |
| 76 bool* cancel); | 76 bool* cancel); |
| 77 | 77 |
| 78 // Returns an id to uniquely identify this PrintPreviewUI. | 78 // Returns an id to uniquely identify this PrintPreviewUI. |
| 79 int32 GetIDForPrintPreviewUI() const; | 79 int32 GetIDForPrintPreviewUI() const; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 // Weak pointer to the WebUI handler. | 172 // Weak pointer to the WebUI handler. |
| 173 PrintPreviewHandler* handler_; | 173 PrintPreviewHandler* handler_; |
| 174 | 174 |
| 175 // Indicates whether the source document can be modified. | 175 // Indicates whether the source document can be modified. |
| 176 bool source_is_modifiable_; | 176 bool source_is_modifiable_; |
| 177 | 177 |
| 178 // Indicates whether the source document has selection. | 178 // Indicates whether the source document has selection. |
| 179 bool source_has_selection_; | 179 bool source_has_selection_; |
| 180 | 180 |
| 181 // Indicates whether only the selection should be printed. |
| 182 bool print_selection_only_; |
| 183 |
| 181 // Store the initiator tab title, used for populating the print preview dialog | 184 // Store the initiator tab title, used for populating the print preview dialog |
| 182 // title. | 185 // title. |
| 183 string16 initiator_tab_title_; | 186 string16 initiator_tab_title_; |
| 184 | 187 |
| 185 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. | 188 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. |
| 186 bool dialog_closed_; | 189 bool dialog_closed_; |
| 187 | 190 |
| 188 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 191 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
| 189 }; | 192 }; |
| 190 | 193 |
| 191 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ | 194 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
| OLD | NEW |