Chromium Code Reviews| 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/files/file_path.h" | |
|
Lei Zhang
2014/07/17 00:30:37
you can forward declare instead.
ivandavid
2014/07/17 20:49:20
Done.
| |
| 10 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 14 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 14 | 15 |
| 15 class PrintPreviewDataService; | 16 class PrintPreviewDataService; |
| 16 class PrintPreviewHandler; | 17 class PrintPreviewHandler; |
| 17 struct PrintHostMsg_DidGetPreviewPageCount_Params; | 18 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
| 18 struct PrintHostMsg_RequestPrintPreview_Params; | 19 struct PrintHostMsg_RequestPrintPreview_Params; |
| 19 | 20 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 | 52 |
| 52 // Returns the available draft page count. | 53 // Returns the available draft page count. |
| 53 int GetAvailableDraftPageCount(); | 54 int GetAvailableDraftPageCount(); |
| 54 | 55 |
| 55 // Setters | 56 // Setters |
| 56 void SetInitiatorTitle(const base::string16& initiator_title); | 57 void SetInitiatorTitle(const base::string16& initiator_title); |
| 57 | 58 |
| 58 base::string16 initiator_title() { return initiator_title_; } | 59 base::string16 initiator_title() { return initiator_title_; } |
| 59 | 60 |
| 60 bool source_is_modifiable() { return source_is_modifiable_; } | 61 bool source_is_modifiable() { return source_is_modifiable_; } |
| 61 | 62 |
|
Lei Zhang
2014/07/17 21:08:16
no random whitespace changes please
| |
| 62 bool source_has_selection() { return source_has_selection_; } | 63 bool source_has_selection() { return source_has_selection_; } |
| 63 | 64 |
| 64 bool print_selection_only() { return print_selection_only_; } | 65 bool print_selection_only() { return print_selection_only_; } |
| 65 | 66 |
| 66 // Set initial settings for PrintPreviewUI. | 67 // Set initial settings for PrintPreviewUI. |
| 67 static void SetInitialParams( | 68 static void SetInitialParams( |
| 68 content::WebContents* print_preview_dialog, | 69 content::WebContents* print_preview_dialog, |
| 69 const PrintHostMsg_RequestPrintPreview_Params& params); | 70 const PrintHostMsg_RequestPrintPreview_Params& params); |
| 70 | 71 |
| 71 // Determines whether to cancel a print preview request based on | 72 // Determines whether to cancel a print preview request based on |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 // also instructs the dialog to auto-cancel, which is used for testing only. | 148 // also instructs the dialog to auto-cancel, which is used for testing only. |
| 148 class TestingDelegate { | 149 class TestingDelegate { |
| 149 public: | 150 public: |
| 150 virtual bool IsAutoCancelEnabled() = 0; | 151 virtual bool IsAutoCancelEnabled() = 0; |
| 151 virtual void DidGetPreviewPageCount(int page_count) = 0; | 152 virtual void DidGetPreviewPageCount(int page_count) = 0; |
| 152 virtual void DidRenderPreviewPage(content::WebContents* preview_dialog) = 0; | 153 virtual void DidRenderPreviewPage(content::WebContents* preview_dialog) = 0; |
| 153 }; | 154 }; |
| 154 | 155 |
| 155 static void SetDelegateForTesting(TestingDelegate* delegate); | 156 static void SetDelegateForTesting(TestingDelegate* delegate); |
| 156 | 157 |
| 158 // Allows for tests to set a file path to print a PDF to. This lso initiates | |
|
Lei Zhang
2014/07/17 00:30:37
lso?
ivandavid
2014/07/17 20:49:21
Oops, should be 'also.'
| |
| 159 // the printing without having to click a button on the print preview dialog. | |
| 160 void SetSelectedFileForTesting( | |
| 161 const base::FilePath& path, int index, void* params); | |
|
Lei Zhang
2014/07/17 00:30:37
|index| and |param| are ultimately unused. Omit th
ivandavid
2014/07/17 20:49:20
Done.
| |
| 162 | |
| 157 private: | 163 private: |
| 158 friend class PrintPreviewHandlerTest; | 164 friend class PrintPreviewHandlerTest; |
| 159 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); | 165 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); |
| 160 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); | 166 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); |
| 161 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 167 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 162 StickyMarginsCustomThenDefault); | 168 StickyMarginsCustomThenDefault); |
| 163 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 169 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 164 GetLastUsedMarginSettingsCustom); | 170 GetLastUsedMarginSettingsCustom); |
| 165 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 171 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 166 GetLastUsedMarginSettingsDefault); | 172 GetLastUsedMarginSettingsDefault); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 192 // title. | 198 // title. |
| 193 base::string16 initiator_title_; | 199 base::string16 initiator_title_; |
| 194 | 200 |
| 195 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. | 201 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. |
| 196 bool dialog_closed_; | 202 bool dialog_closed_; |
| 197 | 203 |
| 198 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 204 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
| 199 }; | 205 }; |
| 200 | 206 |
| 201 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ | 207 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
| OLD | NEW |