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/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | |
14 #include "base/time/time.h" | 13 #include "base/time/time.h" |
15 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 14 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
16 | 15 |
17 class PrintPreviewDataService; | 16 class PrintPreviewDataService; |
18 class PrintPreviewHandler; | 17 class PrintPreviewHandler; |
19 struct PrintHostMsg_DidGetPreviewPageCount_Params; | 18 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
20 struct PrintHostMsg_RequestPrintPreview_Params; | 19 struct PrintHostMsg_RequestPrintPreview_Params; |
21 struct PrintHostMsg_SetOptionsFromDocument_Params; | 20 struct PrintHostMsg_SetOptionsFromDocument_Params; |
22 | 21 |
23 namespace base { | 22 namespace base { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 | 159 |
161 static void SetDelegateForTesting(TestingDelegate* delegate); | 160 static void SetDelegateForTesting(TestingDelegate* delegate); |
162 | 161 |
163 // Allows for tests to set a file path to print a PDF to. This also initiates | 162 // Allows for tests to set a file path to print a PDF to. This also initiates |
164 // the printing without having to click a button on the print preview dialog. | 163 // the printing without having to click a button on the print preview dialog. |
165 void SetSelectedFileForTesting(const base::FilePath& path); | 164 void SetSelectedFileForTesting(const base::FilePath& path); |
166 | 165 |
167 // Passes |closure| to PrintPreviewHandler::SetPdfSavedClosureForTesting(). | 166 // Passes |closure| to PrintPreviewHandler::SetPdfSavedClosureForTesting(). |
168 void SetPdfSavedClosureForTesting(const base::Closure& closure); | 167 void SetPdfSavedClosureForTesting(const base::Closure& closure); |
169 | 168 |
170 base::WeakPtr<PrintPreviewUI> GetWeakPtr(); | |
Lei Zhang
2015/08/14 05:44:36
You should not create a WeakPtrFactory and publicl
| |
171 | |
172 private: | 169 private: |
173 friend class PrintPreviewHandlerTest; | 170 friend class PrintPreviewHandlerTest; |
174 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); | 171 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); |
175 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); | 172 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); |
176 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 173 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
177 StickyMarginsCustomThenDefault); | 174 StickyMarginsCustomThenDefault); |
178 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 175 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
179 GetLastUsedMarginSettingsCustom); | 176 GetLastUsedMarginSettingsCustom); |
180 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 177 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
181 GetLastUsedMarginSettingsDefault); | 178 GetLastUsedMarginSettingsDefault); |
(...skipping 21 matching lines...) Expand all Loading... | |
203 // Indicates whether only the selection should be printed. | 200 // Indicates whether only the selection should be printed. |
204 bool print_selection_only_; | 201 bool print_selection_only_; |
205 | 202 |
206 // Store the initiator title, used for populating the print preview dialog | 203 // Store the initiator title, used for populating the print preview dialog |
207 // title. | 204 // title. |
208 base::string16 initiator_title_; | 205 base::string16 initiator_title_; |
209 | 206 |
210 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. | 207 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. |
211 bool dialog_closed_; | 208 bool dialog_closed_; |
212 | 209 |
213 base::WeakPtrFactory<PrintPreviewUI> weak_ptr_factory_; | |
214 | |
215 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 210 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
216 }; | 211 }; |
217 | 212 |
218 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ | 213 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
OLD | NEW |