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