| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 17 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 18 #include "printing/features/features.h" | 18 #include "printing/features/features.h" |
| 19 | 19 |
| 20 class PrintPreviewHandler; | 20 class PrintPreviewHandler; |
| 21 struct PrintHostMsg_DidGetPreviewPageCount_Params; | 21 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
| 22 struct PrintHostMsg_RequestPrintPreview_Params; | 22 struct PrintHostMsg_RequestPrintPreview_Params; |
| 23 struct PrintHostMsg_SetOptionsFromDocument_Params; | 23 struct PrintHostMsg_SetOptionsFromDocument_Params; |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class DictionaryValue; |
| 26 class FilePath; | 27 class FilePath; |
| 27 class RefCountedBytes; | 28 class RefCountedBytes; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace gfx { | 31 namespace gfx { |
| 31 class Rect; | 32 class Rect; |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace printing { | 35 namespace printing { |
| 35 struct PageSizeMargins; | 36 struct PageSizeMargins; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 152 |
| 152 static void SetDelegateForTesting(TestingDelegate* delegate); | 153 static void SetDelegateForTesting(TestingDelegate* delegate); |
| 153 | 154 |
| 154 // Allows for tests to set a file path to print a PDF to. This also initiates | 155 // Allows for tests to set a file path to print a PDF to. This also initiates |
| 155 // the printing without having to click a button on the print preview dialog. | 156 // the printing without having to click a button on the print preview dialog. |
| 156 void SetSelectedFileForTesting(const base::FilePath& path); | 157 void SetSelectedFileForTesting(const base::FilePath& path); |
| 157 | 158 |
| 158 // Passes |closure| to PrintPreviewHandler::SetPdfSavedClosureForTesting(). | 159 // Passes |closure| to PrintPreviewHandler::SetPdfSavedClosureForTesting(). |
| 159 void SetPdfSavedClosureForTesting(const base::Closure& closure); | 160 void SetPdfSavedClosureForTesting(const base::Closure& closure); |
| 160 | 161 |
| 162 // Tell the handler to send the enable-manipulate-settings-for-test WebUI |
| 163 // event. |
| 164 void SendEnableManipulateSettingsForTest(); |
| 165 |
| 166 // Tell the handler to send the manipulate-settings-for-test WebUI event |
| 167 // to set the print preview settings contained in |settings|. |
| 168 void SendManipulateSettingsForTest(const base::DictionaryValue& settings); |
| 169 |
| 161 private: | 170 private: |
| 162 FRIEND_TEST_ALL_PREFIXES(PrintPreviewDialogControllerUnitTest, | 171 FRIEND_TEST_ALL_PREFIXES(PrintPreviewDialogControllerUnitTest, |
| 163 TitleAfterReload); | 172 TitleAfterReload); |
| 164 | 173 |
| 165 base::TimeTicks initial_preview_start_time_; | 174 base::TimeTicks initial_preview_start_time_; |
| 166 | 175 |
| 167 // The unique ID for this class instance. Stored here to avoid calling | 176 // The unique ID for this class instance. Stored here to avoid calling |
| 168 // GetIDForPrintPreviewUI() everywhere. | 177 // GetIDForPrintPreviewUI() everywhere. |
| 169 const int32_t id_; | 178 const int32_t id_; |
| 170 | 179 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 184 // title. | 193 // title. |
| 185 base::string16 initiator_title_; | 194 base::string16 initiator_title_; |
| 186 | 195 |
| 187 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. | 196 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. |
| 188 bool dialog_closed_; | 197 bool dialog_closed_; |
| 189 | 198 |
| 190 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 199 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
| 191 }; | 200 }; |
| 192 | 201 |
| 193 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ | 202 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
| OLD | NEW |