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

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

Issue 8351048: Print Preview: Making margin selection sticky (part 2/2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 9 years, 1 month 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_handler.h
diff --git a/chrome/browser/ui/webui/print_preview_handler.h b/chrome/browser/ui/webui/print_preview_handler.h
index cda79c877db47245a010640785575295adfdf2c0..20ea1c73463db8589acc1be22b2d031fdb51cba0 100644
--- a/chrome/browser/ui/webui/print_preview_handler.h
+++ b/chrome/browser/ui/webui/print_preview_handler.h
@@ -27,6 +27,7 @@ class StringValue;
}
namespace printing {
+struct PageSizeMargins;
class PrintBackend;
}
@@ -67,14 +68,20 @@ class PrintPreviewHandler : public WebUIMessageHandler,
void ShowSystemDialog();
private:
+ friend class PrintPreviewHandlerTest;
friend class PrintSystemTaskProxy;
+ FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom);
+ FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault);
+ FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest,
+ StickyMarginsCustomThenDefault);
+ FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest,
+ GetLastUsedMarginSettingsCustom);
+ FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest,
+ GetLastUsedMarginSettingsDefault);
TabContentsWrapper* preview_tab_wrapper() const;
TabContents* preview_tab() const;
- // Gets the default printer. |args| is unused.
- void HandleGetDefaultPrinter(const base::ListValue* args);
-
// Gets the list of printers. |args| is unused.
void HandleGetPrinters(const base::ListValue* args);
@@ -131,22 +138,18 @@ class PrintPreviewHandler : public WebUIMessageHandler,
// Asks the browser to close the preview tab. |args| is unused.
void HandleClosePreviewTab(const base::ListValue* args);
- // Asks the browser for the title of the initiator tab.
- // |args| is unused.
- void HandleGetInitiatorTabTitle(const base::ListValue* args);
+ // Asks the browser for several settings that are needed before the first
+ // preview is displayed.
+ void HandleGetInitialSettings(const base::ListValue* args);
- // Asks the browser for the number formatting and measurement system according
- // to the current locale.
- void HandleGetNumberFormatAndMeasurementSystem(const base::ListValue* args);
+ void SendInitialSettings(
+ const std::string& default_printer,
+ const std::string& cloud_print_data);
// Sends the printer capabilities to the Web UI. |settings_info| contains
// printer capabilities information.
void SendPrinterCapabilities(const base::DictionaryValue& settings_info);
- // Sends the default printer to the Web UI.
- void SendDefaultPrinter(const base::StringValue& default_printer,
- const base::StringValue& cloud_print_data);
-
// Send the list of printers to the Web UI.
void SetupPrinterList(const base::ListValue& printers);
@@ -178,6 +181,14 @@ class PrintPreviewHandler : public WebUIMessageHandler,
// Posts a task to save to pdf at |print_to_pdf_path_|.
void PostPrintToPdfTask();
+ // Populates |settings| according to the current locale.
+ void GetNumberFormatAndMeasurementSystem(base::DictionaryValue* settings);
+
+ // Populates |last_used_custom_margins| according to the last used margin
+ // settings.
+ void GetLastUsedMarginSettings(
+ base::DictionaryValue* last_used_custom_margins);
+
// Pointer to current print system.
scoped_refptr<printing::PrintBackend> print_backend_;
@@ -189,6 +200,7 @@ class PrintPreviewHandler : public WebUIMessageHandler,
static std::string* last_used_printer_name_;
static printing::ColorModels last_used_color_model_;
static printing::MarginType last_used_margins_type_;
+ static printing::PageSizeMargins* last_used_page_size_margins_;
// A count of how many requests received to regenerate preview data.
// Initialized to 0 then incremented and emitted to a histogram.
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview.js ('k') | chrome/browser/ui/webui/print_preview_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698