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 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" | 5 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 printer_app_state_.reset(new std::string(data)); | 27 printer_app_state_.reset(new std::string(data)); |
28 } | 28 } |
29 | 29 |
30 void StickySettings::StoreSavePath(const base::FilePath& path) { | 30 void StickySettings::StoreSavePath(const base::FilePath& path) { |
31 save_path_.reset(new base::FilePath(path)); | 31 save_path_.reset(new base::FilePath(path)); |
32 } | 32 } |
33 | 33 |
34 void StickySettings::SaveInPrefs(PrefService* prefs) { | 34 void StickySettings::SaveInPrefs(PrefService* prefs) { |
35 DCHECK(prefs); | 35 DCHECK(prefs); |
36 if (prefs) { | 36 if (prefs) { |
37 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); | 37 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue); |
38 if (save_path_.get()) | 38 if (save_path_.get()) |
39 value->SetString(printing::kSettingSavePath, save_path_->value()); | 39 value->SetString(printing::kSettingSavePath, save_path_->value()); |
40 if (printer_app_state_.get()) | 40 if (printer_app_state_.get()) |
41 value->SetString(printing::kSettingAppState, | 41 value->SetString(printing::kSettingAppState, |
42 *printer_app_state_); | 42 *printer_app_state_); |
43 prefs->Set(prefs::kPrintPreviewStickySettings, *value); | 43 prefs->Set(prefs::kPrintPreviewStickySettings, *value); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 void StickySettings::RestoreFromPrefs(PrefService* prefs) { | 47 void StickySettings::RestoreFromPrefs(PrefService* prefs) { |
(...skipping 18 matching lines...) Expand all Loading... |
66 | 66 |
67 std::string* StickySettings::printer_app_state() { | 67 std::string* StickySettings::printer_app_state() { |
68 return printer_app_state_.get(); | 68 return printer_app_state_.get(); |
69 } | 69 } |
70 | 70 |
71 base::FilePath* StickySettings::save_path() { | 71 base::FilePath* StickySettings::save_path() { |
72 return save_path_.get(); | 72 return save_path_.get(); |
73 } | 73 } |
74 | 74 |
75 } // namespace printing | 75 } // namespace printing |
OLD | NEW |