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_STICKY_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_STICKY_SETTINGS_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_STICKY_SETTINGS_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_STICKY_SETTINGS_H_ |
7 | 7 |
8 #include "printing/print_job_constants.h" | 8 #include "printing/print_job_constants.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
14 class FilePath; | 14 class FilePath; |
15 class PrintPreviewHandlerTest; | 15 class PrintPreviewHandlerTest; |
16 class PrefService; | 16 class PrefService; |
| 17 class PrefServiceSyncable; |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class DictionaryValue; | 20 class DictionaryValue; |
20 } | 21 } |
21 | 22 |
22 namespace printing { | 23 namespace printing { |
23 | 24 |
24 // Holds all the settings that should be remembered (sticky) in print preview. | 25 // Holds all the settings that should be remembered (sticky) in print preview. |
25 // A sticky setting will be restored next time the user launches print preview. | 26 // A sticky setting will be restored next time the user launches print preview. |
26 // Only one instance of this class is instantiated. | 27 // Only one instance of this class is instantiated. |
27 class StickySettings { | 28 class StickySettings { |
28 public: | 29 public: |
29 StickySettings(); | 30 StickySettings(); |
30 ~StickySettings(); | 31 ~StickySettings(); |
31 | 32 |
32 FilePath* save_path(); | 33 FilePath* save_path(); |
33 std::string* printer_app_state(); | 34 std::string* printer_app_state(); |
34 | 35 |
35 // Stores app state for the last used printer. | 36 // Stores app state for the last used printer. |
36 void StoreAppState(const std::string& app_state); | 37 void StoreAppState(const std::string& app_state); |
37 // Stores the last path the user used to save to pdf. | 38 // Stores the last path the user used to save to pdf. |
38 void StoreSavePath(const FilePath& path); | 39 void StoreSavePath(const FilePath& path); |
39 | 40 |
40 void SaveInPrefs(PrefService* profile); | 41 void SaveInPrefs(PrefService* profile); |
41 void RestoreFromPrefs(PrefService* profile); | 42 void RestoreFromPrefs(PrefService* profile); |
42 static void RegisterUserPrefs(PrefService* prefs); | 43 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
43 private: | 44 private: |
44 | 45 |
45 scoped_ptr<FilePath> save_path_; | 46 scoped_ptr<FilePath> save_path_; |
46 scoped_ptr<std::string> printer_app_state_; | 47 scoped_ptr<std::string> printer_app_state_; |
47 }; | 48 }; |
48 | 49 |
49 } // namespace printing | 50 } // namespace printing |
50 | 51 |
51 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_STICKY_SETTINGS_H_ | 52 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_STICKY_SETTINGS_H_ |
OLD | NEW |