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/callback_forward.h" | |
| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 virtual void DidGetPreviewPageCount(int page_count) = 0; | 153 virtual void DidGetPreviewPageCount(int page_count) = 0; |
| 153 virtual void DidRenderPreviewPage(content::WebContents* preview_dialog) = 0; | 154 virtual void DidRenderPreviewPage(content::WebContents* preview_dialog) = 0; |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 static void SetDelegateForTesting(TestingDelegate* delegate); | 157 static void SetDelegateForTesting(TestingDelegate* delegate); |
| 157 | 158 |
| 158 // Allows for tests to set a file path to print a PDF to. This also initiates | 159 // Allows for tests to set a file path to print a PDF to. This also initiates |
| 159 // the printing without having to click a button on the print preview dialog. | 160 // the printing without having to click a button on the print preview dialog. |
| 160 void SetSelectedFileForTesting(const base::FilePath& path); | 161 void SetSelectedFileForTesting(const base::FilePath& path); |
| 161 | 162 |
| 163 // Calls |handler->SetPdfSavedClosureForTesting()|. Allows for tests waiting | |
|
Lei Zhang
2014/07/22 21:25:37
Since PrintPreviewUI doesn't actually do anything
ivandavid
2014/07/22 21:46:07
Done.
| |
| 164 // to see if an attempt to save the PDF was made. It doesn't notify the test | |
| 165 // if the save was successful for not. | |
| 166 void SetPdfSavedClosureForTesting(const base::Closure& closure); | |
| 167 | |
| 162 private: | 168 private: |
| 163 friend class PrintPreviewHandlerTest; | 169 friend class PrintPreviewHandlerTest; |
| 164 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); | 170 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); |
| 165 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); | 171 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); |
| 166 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 172 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 167 StickyMarginsCustomThenDefault); | 173 StickyMarginsCustomThenDefault); |
| 168 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 174 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 169 GetLastUsedMarginSettingsCustom); | 175 GetLastUsedMarginSettingsCustom); |
| 170 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 176 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
| 171 GetLastUsedMarginSettingsDefault); | 177 GetLastUsedMarginSettingsDefault); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 197 // title. | 203 // title. |
| 198 base::string16 initiator_title_; | 204 base::string16 initiator_title_; |
| 199 | 205 |
| 200 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. | 206 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. |
| 201 bool dialog_closed_; | 207 bool dialog_closed_; |
| 202 | 208 |
| 203 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); | 209 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); |
| 204 }; | 210 }; |
| 205 | 211 |
| 206 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ | 212 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ |
| OLD | NEW |