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

Side by Side Diff: chrome/browser/profile_resetter/brandcoded_default_settings.cc

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/profile_resetter/brandcoded_default_settings.h" 5 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "chrome/installer/util/master_preferences_constants.h" 10 #include "chrome/installer/util/master_preferences_constants.h"
11 #include "components/crx_file/id_util.h"
11 #include "components/search_engines/search_engines_pref_names.h" 12 #include "components/search_engines/search_engines_pref_names.h"
12 #include "extensions/common/extension.h"
13 13
14 BrandcodedDefaultSettings::BrandcodedDefaultSettings() { 14 BrandcodedDefaultSettings::BrandcodedDefaultSettings() {
15 } 15 }
16 16
17 BrandcodedDefaultSettings::BrandcodedDefaultSettings(const std::string& prefs) { 17 BrandcodedDefaultSettings::BrandcodedDefaultSettings(const std::string& prefs) {
18 if (!prefs.empty()) { 18 if (!prefs.empty()) {
19 JSONStringValueSerializer json(prefs); 19 JSONStringValueSerializer json(prefs);
20 std::string error; 20 std::string error;
21 scoped_ptr<base::Value> root(json.Deserialize(NULL, &error)); 21 scoped_ptr<base::Value> root(json.Deserialize(NULL, &error));
22 if (!root.get()) { 22 if (!root.get()) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 bool BrandcodedDefaultSettings::GetExtensions( 64 bool BrandcodedDefaultSettings::GetExtensions(
65 std::vector<std::string>* extension_ids) const { 65 std::vector<std::string>* extension_ids) const {
66 DCHECK(extension_ids); 66 DCHECK(extension_ids);
67 base::DictionaryValue* extensions = NULL; 67 base::DictionaryValue* extensions = NULL;
68 if (master_dictionary_ && 68 if (master_dictionary_ &&
69 master_dictionary_->GetDictionary( 69 master_dictionary_->GetDictionary(
70 installer::master_preferences::kExtensionsBlock, 70 installer::master_preferences::kExtensionsBlock,
71 &extensions)) { 71 &extensions)) {
72 for (base::DictionaryValue::Iterator extension_id(*extensions); 72 for (base::DictionaryValue::Iterator extension_id(*extensions);
73 !extension_id.IsAtEnd(); extension_id.Advance()) { 73 !extension_id.IsAtEnd(); extension_id.Advance()) {
74 if (extensions::Extension::IdIsValid(extension_id.key())) 74 if (crx_file::id_util::IdIsValid(extension_id.key()))
75 extension_ids->push_back(extension_id.key()); 75 extension_ids->push_back(extension_id.key());
76 } 76 }
77 return true; 77 return true;
78 } 78 }
79 return false; 79 return false;
80 } 80 }
81 81
82 bool BrandcodedDefaultSettings::GetRestoreOnStartup( 82 bool BrandcodedDefaultSettings::GetRestoreOnStartup(
83 int* restore_on_startup) const { 83 int* restore_on_startup) const {
84 return master_dictionary_ && 84 return master_dictionary_ &&
85 master_dictionary_->GetInteger(prefs::kRestoreOnStartup, 85 master_dictionary_->GetInteger(prefs::kRestoreOnStartup,
86 restore_on_startup); 86 restore_on_startup);
87 } 87 }
88 88
89 scoped_ptr<base::ListValue> 89 scoped_ptr<base::ListValue>
90 BrandcodedDefaultSettings::GetUrlsToRestoreOnStartup() const { 90 BrandcodedDefaultSettings::GetUrlsToRestoreOnStartup() const {
91 return ExtractList(prefs::kURLsToRestoreOnStartup); 91 return ExtractList(prefs::kURLsToRestoreOnStartup);
92 } 92 }
93 93
94 scoped_ptr<base::ListValue> BrandcodedDefaultSettings::ExtractList( 94 scoped_ptr<base::ListValue> BrandcodedDefaultSettings::ExtractList(
95 const char* pref_name) const { 95 const char* pref_name) const {
96 const base::ListValue* value = NULL; 96 const base::ListValue* value = NULL;
97 if (master_dictionary_ && 97 if (master_dictionary_ &&
98 master_dictionary_->GetList(pref_name, &value) && 98 master_dictionary_->GetList(pref_name, &value) &&
99 !value->empty()) { 99 !value->empty()) {
100 return scoped_ptr<base::ListValue>(value->DeepCopy()); 100 return scoped_ptr<base::ListValue>(value->DeepCopy());
101 } 101 }
102 return scoped_ptr<base::ListValue>(); 102 return scoped_ptr<base::ListValue>();
103 } 103 }
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/media_galleries_test_util.cc ('k') | chrome/browser/sync/test/integration/sync_app_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698