Chromium Code Reviews| 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/extensions/extension_prefs.h" | 5 #include "chrome/browser/extensions/extension_prefs.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_notifier.h" | 8 #include "base/prefs/pref_notifier.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1150 continue; | 1150 continue; |
| 1151 bool writable = false; | 1151 bool writable = false; |
| 1152 if (!file_entry->GetBoolean(kFileEntryWritable, &writable)) | 1152 if (!file_entry->GetBoolean(kFileEntryWritable, &writable)) |
| 1153 continue; | 1153 continue; |
| 1154 base::FilePath file_path(path_string); | 1154 base::FilePath file_path(path_string); |
| 1155 out->push_back(app_file_handler_util::SavedFileEntry( | 1155 out->push_back(app_file_handler_util::SavedFileEntry( |
| 1156 it.key(), file_path, writable)); | 1156 it.key(), file_path, writable)); |
| 1157 } | 1157 } |
| 1158 } | 1158 } |
| 1159 | 1159 |
| 1160 ExtensionOmniboxSuggestion | 1160 scoped_ptr<api::omnibox::SuggestDefaultResult> |
| 1161 ExtensionPrefs::GetOmniboxDefaultSuggestion(const std::string& extension_id) { | 1161 ExtensionPrefs::GetOmniboxDefaultSuggestion(const std::string& extension_id) { |
| 1162 ExtensionOmniboxSuggestion suggestion; | 1162 scoped_ptr<api::omnibox::SuggestDefaultResult> suggestion(0); |
|
not at google - send to devlin
2013/03/16 00:04:25
use NULL not 0, but besides scoped_ptrs are alread
Aaron Jacobs
2013/03/21 21:59:55
Done.
| |
| 1163 | 1163 |
| 1164 const DictionaryValue* extension = GetExtensionPref(extension_id); | 1164 const DictionaryValue* extension = GetExtensionPref(extension_id); |
| 1165 const DictionaryValue* dict = NULL; | 1165 const DictionaryValue* dict = NULL; |
| 1166 if (extension && extension->GetDictionary(kOmniboxDefaultSuggestion, &dict)) | 1166 if (extension && extension->GetDictionary(kOmniboxDefaultSuggestion, &dict)) { |
| 1167 suggestion.Populate(*dict, false); | 1167 suggestion.reset(new api::omnibox::SuggestDefaultResult); |
| 1168 api::omnibox::SuggestDefaultResult::Populate(*dict, suggestion.get()); | |
| 1169 } | |
| 1168 | 1170 |
| 1169 return suggestion; | 1171 return suggestion.Pass(); |
| 1170 } | 1172 } |
| 1171 | 1173 |
| 1172 void ExtensionPrefs::SetOmniboxDefaultSuggestion( | 1174 void ExtensionPrefs::SetOmniboxDefaultSuggestion( |
| 1173 const std::string& extension_id, | 1175 const std::string& extension_id, |
| 1174 const ExtensionOmniboxSuggestion& suggestion) { | 1176 const api::omnibox::SuggestDefaultResult& suggestion) { |
| 1175 scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue().Pass(); | 1177 scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue().Pass(); |
|
not at google - send to devlin
2013/03/16 00:04:25
not sure if Pass is necessary here, rvalues on sco
Aaron Jacobs
2013/03/21 21:59:55
Done.
| |
| 1176 UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion, dict.release()); | 1178 UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion, dict.release()); |
| 1177 } | 1179 } |
| 1178 | 1180 |
| 1179 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) { | 1181 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) { |
| 1180 return ReadExtensionPrefBoolean(extension_id, kPrefIncognitoEnabled); | 1182 return ReadExtensionPrefBoolean(extension_id, kPrefIncognitoEnabled); |
| 1181 } | 1183 } |
| 1182 | 1184 |
| 1183 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id, | 1185 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id, |
| 1184 bool enabled) { | 1186 bool enabled) { |
| 1185 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled, | 1187 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled, |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2396 is_enabled = initial_state == Extension::ENABLED; | 2398 is_enabled = initial_state == Extension::ENABLED; |
| 2397 } | 2399 } |
| 2398 | 2400 |
| 2399 extension_pref_value_map_->RegisterExtension(extension_id, install_time, | 2401 extension_pref_value_map_->RegisterExtension(extension_id, install_time, |
| 2400 is_enabled); | 2402 is_enabled); |
| 2401 content_settings_store_->RegisterExtension(extension_id, install_time, | 2403 content_settings_store_->RegisterExtension(extension_id, install_time, |
| 2402 is_enabled); | 2404 is_enabled); |
| 2403 } | 2405 } |
| 2404 | 2406 |
| 2405 } // namespace extensions | 2407 } // namespace extensions |
| OLD | NEW |