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

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.h

Issue 2804793002: Print Preview: Fix failure to save with long page title (Closed)
Patch Set: Add integration test Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/print_preview/print_preview_handler.h
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.h b/chrome/browser/ui/webui/print_preview/print_preview_handler.h
index fcfc22f2c8709f88fb58a0d926c45f146ea77ea5..c26c451cbc3ae340d2f7368680b4bfb110bdc29a 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.h
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.h
@@ -105,6 +105,18 @@ class PrintPreviewHandler
// Sets |pdf_file_saved_closure_| to |closure|.
void SetPdfSavedClosureForTesting(const base::Closure& closure);
+ protected:
+ // If |prompt_user| is true, displays a modal dialog, prompting the user to
+ // select a file. Otherwise, just accept |default_path| and uniquify it.
+ // Protected so unit tests can access.
+ virtual void SelectFile(const base::FilePath& default_path, bool prompt_user);
+
+ // Handles printing to PDF. Protected to expose to unit tests.
+ void PrintToPdf();
+
+ // The underlying dialog object. Protecteed to expose to unit tests.
Lei Zhang 2017/04/19 21:14:07 typo
rbpotter 2017/04/19 23:30:12 Done.
+ scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
+
private:
friend class PrintPreviewPdfGeneratedBrowserTest;
FRIEND_TEST_ALL_PREFIXES(PrintPreviewPdfGeneratedBrowserTest,
@@ -237,9 +249,6 @@ class PrintPreviewHandler
// Send the PDF data to the cloud to print.
void SendCloudPrintJob(const base::RefCountedBytes* data);
- // Handles printing to PDF.
- void PrintToPdf();
-
// Gets the initiator for the print preview dialog.
content::WebContents* GetInitiator() const;
@@ -253,7 +262,7 @@ class PrintPreviewHandler
void ClearInitiatorDetails();
// Posts a task to save |data| to pdf at |print_to_pdf_path_|.
- void PostPrintToPdfTask();
+ virtual void PostPrintToPdfTask();
Lei Zhang 2017/04/19 21:14:07 Still need to be virtual?
rbpotter 2017/04/19 23:30:12 Done.
// Populates |settings| according to the current locale.
void GetNumberFormatAndMeasurementSystem(base::DictionaryValue* settings);
@@ -261,10 +270,6 @@ class PrintPreviewHandler
bool GetPreviewDataAndTitle(scoped_refptr<base::RefCountedBytes>* data,
base::string16* title) const;
- // If |prompt_user| is true, displays a modal dialog, prompting the user to
- // select a file. Otherwise, just accept |default_path| and uniquify it.
- void SelectFile(const base::FilePath& default_path, bool prompt_user);
-
// Helper for getting a unique file name for SelectFile() without prompting
// the user. Just an adaptor for FileSelected().
void OnGotUniqueFileName(const base::FilePath& path);
@@ -344,9 +349,6 @@ class PrintPreviewHandler
void RegisterForGaiaCookieChanges();
void UnregisterForGaiaCookieChanges();
- // The underlying dialog object.
- scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
-
// A count of how many requests received to regenerate preview data.
// Initialized to 0 then incremented and emitted to a histogram.
int regenerate_preview_request_count_;

Powered by Google App Engine
This is Rietveld 408576698