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

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

Issue 10909124: Improves application state persistance. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updates unit tests. Created 8 years, 3 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/sticky_settings.h
diff --git a/chrome/browser/ui/webui/print_preview/sticky_settings.h b/chrome/browser/ui/webui/print_preview/sticky_settings.h
index 85e0cb4b406d2762a7c1f6218a094f817c5ddff6..f34d4bfd6f7fc98f327f5314438451289d7e9a49 100644
--- a/chrome/browser/ui/webui/print_preview/sticky_settings.h
+++ b/chrome/browser/ui/webui/print_preview/sticky_settings.h
@@ -9,7 +9,6 @@
#include <string>
-#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
class FilePath;
@@ -21,44 +20,20 @@ class DictionaryValue;
}
namespace printing {
-struct PageSizeMargins;
-}
-
-FORWARD_DECLARE_TEST(PrintPreviewHandlerTest, StickyMarginsCustom);
-FORWARD_DECLARE_TEST(PrintPreviewHandlerTest, StickyMarginsDefault);
-FORWARD_DECLARE_TEST(PrintPreviewHandlerTest, StickyMarginsCustomThenDefault);
-FORWARD_DECLARE_TEST(PrintPreviewHandlerTest, GetLastUsedMarginSettingsCustom);
-FORWARD_DECLARE_TEST(PrintPreviewHandlerTest, GetLastUsedMarginSettingsDefault);
-
-namespace printing {
// Holds all the settings that should be remembered (sticky) in print preview.
// A sticky setting will be restored next time the user launches print preview.
// Only one instance of this class is instantiated.
-// TODO(abodenha) Simplify this class. See http://crbug.com/136926.
class StickySettings {
public:
StickySettings();
~StickySettings();
- // Populates |last_used_custom_margins| according to the last used margin
- // settings.
- void GetLastUsedMarginSettings(
- base::DictionaryValue* last_used_custom_margins) const;
-
- std::string* printer_name();
- std::string* printer_cloud_print_data();
- printing::ColorModels color_model() const;
- bool headers_footers() const;
FilePath* save_path();
- printing::DuplexMode duplex_mode() const;
+ std::string* printer_app_state();
- // Stores color model, duplex mode, margins and headers footers.
- void Store(const base::DictionaryValue& settings);
- // Stores last used printer name.
- void StorePrinterName(const std::string& printer_name);
- // Stores last used printer cloud print data.
- void StoreCloudPrintData(const std::string& cloud_print_data);
+ // Stores app state for the last used printer.
+ void StoreAppState(const std::string& app_state);
// Stores the last path the user used to save to pdf.
void StoreSavePath(const FilePath& path);
@@ -66,29 +41,9 @@ class StickySettings {
void RestoreFromPrefs(PrefService* profile);
static void RegisterUserPrefs(PrefService* prefs);
private:
- void StoreColorModel(const base::DictionaryValue& settings);
- void StoreMarginSettings(const base::DictionaryValue& settings);
- void StoreHeadersFooters(const base::DictionaryValue& settings);
- void StoreDuplexMode(const base::DictionaryValue& settings);
scoped_ptr<FilePath> save_path_;
- scoped_ptr<std::string> printer_name_;
- scoped_ptr<std::string> printer_cloud_print_data_;
- printing::ColorModels color_model_;
- printing::MarginType margins_type_;
- scoped_ptr<printing::PageSizeMargins> page_size_margins_;
- bool headers_footers_;
- printing::DuplexMode duplex_mode_;
-
- friend class ::PrintPreviewHandlerTest;
- 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);
+ scoped_ptr<std::string> printer_app_state_;
};
} // namespace printing

Powered by Google App Engine
This is Rietveld 408576698