| 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/memory/weak_ptr.h" | |
| 17 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 18 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 17 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 19 | 18 |
| 20 class PrintPreviewDataService; | 19 class PrintPreviewDataService; |
| 21 class PrintPreviewHandler; | 20 class PrintPreviewHandler; |
| 22 struct PrintHostMsg_DidGetPreviewPageCount_Params; | 21 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
| 23 struct PrintHostMsg_RequestPrintPreview_Params; | 22 struct PrintHostMsg_RequestPrintPreview_Params; |
| 24 struct PrintHostMsg_SetOptionsFromDocument_Params; | 23 struct PrintHostMsg_SetOptionsFromDocument_Params; |
| 25 | 24 |
| 26 namespace base { | 25 namespace base { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 157 |
| 159 static void SetDelegateForTesting(TestingDelegate* delegate); | 158 static void SetDelegateForTesting(TestingDelegate* delegate); |
| 160 | 159 |
| 161 // Allows for tests to set a file path to print a PDF to. This also initiates | 160 // Allows for tests to set a file path to print a PDF to. This also initiates |
| 162 // the printing without having to click a button on the print preview dialog. | 161 // the printing without having to click a button on the print preview dialog. |
| 163 void SetSelectedFileForTesting(const base::FilePath& path); | 162 void SetSelectedFileForTesting(const base::FilePath& path); |
| 164 | 163 |
| 165 // Passes |closure| to PrintPreviewHandler::SetPdfSavedClosureForTesting(). | 164 // Passes |closure| to PrintPreviewHandler::SetPdfSavedClosureForTesting(). |
| 166 void SetPdfSavedClosureForTesting(const base::Closure& closure); | 165 void SetPdfSavedClosureForTesting(const base::Closure& closure); |
| 167 | 166 |
| 168 base::WeakPtr<PrintPreviewUI> GetWeakPtr(); | |
| 169 | |
| 170 private: | 167 private: |
| 171 FRIEND_TEST_ALL_PREFIXES(PrintPreviewDialogControllerUnitTest, | 168 FRIEND_TEST_ALL_PREFIXES(PrintPreviewDialogControllerUnitTest, |
| 172 TitleAfterReload); | 169 TitleAfterReload); |
| 173 | 170 |
| 174 // Returns the Singleton instance of the PrintPreviewDataService. | 171 // Returns the Singleton instance of the PrintPreviewDataService. |
| 175 PrintPreviewDataService* print_preview_data_service(); | 172 PrintPreviewDataService* print_preview_data_service(); |
| 176 | 173 |
| 177 base::TimeTicks initial_preview_start_time_; | 174 base::TimeTicks initial_preview_start_time_; |
| 178 | 175 |
| 179 // 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 192 // Indicates whether only the selection should be printed. | 189 // Indicates whether only the selection should be printed. |
| 193 bool print_selection_only_; | 190 bool print_selection_only_; |
| 194 | 191 |
| 195 // Store the initiator title, used for populating the print preview dialog | 192 // Store the initiator title, used for populating the print preview dialog |
| 196 // title. | 193 // title. |
| 197 base::string16 initiator_title_; | 194 base::string16 initiator_title_; |
| 198 | 195 |
| 199 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. | 196 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. |
| 200 bool dialog_closed_; | 197 bool dialog_closed_; |
| 201 | 198 |
| 202 base::WeakPtrFactory<PrintPreviewUI> weak_ptr_factory_; | |
| 203 | |
| 204 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 199 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
| 205 }; | 200 }; |
| 206 | 201 |
| 207 #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 |