Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.h

Issue 2952043002: Print Preview: Create Save As PDF directory if it does not exist. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 #endif 100 #endif
101 101
102 int regenerate_preview_request_count() const { 102 int regenerate_preview_request_count() const {
103 return regenerate_preview_request_count_; 103 return regenerate_preview_request_count_;
104 } 104 }
105 105
106 // Sets |pdf_file_saved_closure_| to |closure|. 106 // Sets |pdf_file_saved_closure_| to |closure|.
107 void SetPdfSavedClosureForTesting(const base::Closure& closure); 107 void SetPdfSavedClosureForTesting(const base::Closure& closure);
108 108
109 protected: 109 protected:
110 // If |prompt_user| is true, displays a modal dialog, prompting the user to 110 // If |prompt_user| is true, starts a task to create the default Save As PDF
111 // select a file. Otherwise, just accept |default_path| and uniquify it. 111 // directory if needed. |OnDirectoryCreated| will be called when this
Lei Zhang 2017/06/22 01:39:56 nit: OnDirectoryCreated() is not a variable. s/th
rbpotter 2017/06/22 19:57:26 Done.
112 // finishes to open the modal dialog and prompt the user. Otherwise, just
113 // accept |default_path| and uniquify it.
112 // Protected so unit tests can access. 114 // Protected so unit tests can access.
113 virtual void SelectFile(const base::FilePath& default_path, bool prompt_user); 115 virtual void SelectFile(const base::FilePath& default_path, bool prompt_user);
114 116
115 // Handles printing to PDF. Protected to expose to unit tests. 117 // Handles printing to PDF. Protected to expose to unit tests.
116 void PrintToPdf(); 118 void PrintToPdf();
117 119
118 // The underlying dialog object. Protected to expose to unit tests. 120 // The underlying dialog object. Protected to expose to unit tests.
119 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; 121 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
120 122
121 private: 123 private:
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 257
256 // Closes the preview dialog. 258 // Closes the preview dialog.
257 void ClosePreviewDialog(); 259 void ClosePreviewDialog();
258 260
259 // Adds all the recorded stats taken so far to histogram counts. 261 // Adds all the recorded stats taken so far to histogram counts.
260 void ReportStats(); 262 void ReportStats();
261 263
262 // Clears initiator details for the print preview dialog. 264 // Clears initiator details for the print preview dialog.
263 void ClearInitiatorDetails(); 265 void ClearInitiatorDetails();
264 266
267 // Called when the directory to save to has been created. Opens a modal
268 // dialog to prompt the user to select the file for Save As PDF.
269 void OnDirectoryCreated(base::FilePath path);
Lei Zhang 2017/06/22 01:39:56 Pass by const ref.
rbpotter 2017/06/22 19:57:26 Done.
270
265 // Posts a task to save |data| to pdf at |print_to_pdf_path_|. 271 // Posts a task to save |data| to pdf at |print_to_pdf_path_|.
266 void PostPrintToPdfTask(); 272 void PostPrintToPdfTask();
267 273
268 // Populates |settings| according to the current locale. 274 // Populates |settings| according to the current locale.
269 void GetNumberFormatAndMeasurementSystem(base::DictionaryValue* settings); 275 void GetNumberFormatAndMeasurementSystem(base::DictionaryValue* settings);
270 276
271 bool GetPreviewDataAndTitle(scoped_refptr<base::RefCountedBytes>* data, 277 bool GetPreviewDataAndTitle(scoped_refptr<base::RefCountedBytes>* data,
272 base::string16* title) const; 278 base::string16* title) const;
273 279
274 // Helper for getting a unique file name for SelectFile() without prompting 280 // Helper for getting a unique file name for SelectFile() without prompting
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // Proxy for calls to the print backend. Lazily initialized since web_ui() is 418 // Proxy for calls to the print backend. Lazily initialized since web_ui() is
413 // not available at construction time. 419 // not available at construction time.
414 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; 420 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_;
415 421
416 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; 422 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_;
417 423
418 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 424 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
419 }; 425 };
420 426
421 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 427 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698