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

Side by Side Diff: chrome/browser/extensions/extension_prefs.cc

Issue 12314164: Modified Omnibox extension api to use JSON Schema Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: kalman's requests Created 7 years, 9 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
OLDNEW
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 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 continue; 1136 continue;
1137 bool writable = false; 1137 bool writable = false;
1138 if (!file_entry->GetBoolean(kFileEntryWritable, &writable)) 1138 if (!file_entry->GetBoolean(kFileEntryWritable, &writable))
1139 continue; 1139 continue;
1140 base::FilePath file_path(path_string); 1140 base::FilePath file_path(path_string);
1141 out->push_back(app_file_handler_util::SavedFileEntry( 1141 out->push_back(app_file_handler_util::SavedFileEntry(
1142 it.key(), file_path, writable)); 1142 it.key(), file_path, writable));
1143 } 1143 }
1144 } 1144 }
1145 1145
1146 ExtensionOmniboxSuggestion 1146 scoped_ptr<api::omnibox::SuggestResult>
1147 ExtensionPrefs::GetOmniboxDefaultSuggestion(const std::string& extension_id) { 1147 ExtensionPrefs::GetOmniboxDefaultSuggestion(const std::string& extension_id) {
1148 ExtensionOmniboxSuggestion suggestion; 1148 scoped_ptr<api::omnibox::SuggestResult> suggestion;
1149 1149
1150 const DictionaryValue* extension = GetExtensionPref(extension_id); 1150 const DictionaryValue* extension = GetExtensionPref(extension_id);
1151 const DictionaryValue* dict = NULL; 1151 const DictionaryValue* dict = NULL;
1152 if (extension && extension->GetDictionary(kOmniboxDefaultSuggestion, &dict)) 1152 if (extension && extension->GetDictionary(kOmniboxDefaultSuggestion, &dict)) {
1153 suggestion.Populate(*dict, false); 1153 suggestion.reset(new api::omnibox::SuggestResult);
1154 api::omnibox::SuggestResult::Populate(*dict, suggestion.get());
1155 }
1154 1156
1155 return suggestion; 1157 return suggestion.Pass();
1156 } 1158 }
1157 1159
1158 void ExtensionPrefs::SetOmniboxDefaultSuggestion( 1160 void ExtensionPrefs::SetOmniboxDefaultSuggestion(
1159 const std::string& extension_id, 1161 const std::string& extension_id,
1160 const ExtensionOmniboxSuggestion& suggestion) { 1162 const api::omnibox::SuggestResult& suggestion) {
1161 scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue().Pass(); 1163 scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue();
1164 // A default suggestion should not have the content field set.
1165 dict->SetString("content", "");
not at google - send to devlin 2013/03/22 23:30:32 dict->Remove("content")?
Aaron Jacobs 2013/03/22 23:56:40 Done.
1162 UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion, dict.release()); 1166 UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion, dict.release());
1163 } 1167 }
1164 1168
1165 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) { 1169 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) {
1166 return ReadExtensionPrefBoolean(extension_id, kPrefIncognitoEnabled); 1170 return ReadExtensionPrefBoolean(extension_id, kPrefIncognitoEnabled);
1167 } 1171 }
1168 1172
1169 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id, 1173 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id,
1170 bool enabled) { 1174 bool enabled) {
1171 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled, 1175 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled,
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 is_enabled = initial_state == Extension::ENABLED; 2363 is_enabled = initial_state == Extension::ENABLED;
2360 } 2364 }
2361 2365
2362 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 2366 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
2363 is_enabled); 2367 is_enabled);
2364 content_settings_store_->RegisterExtension(extension_id, install_time, 2368 content_settings_store_->RegisterExtension(extension_id, install_time,
2365 is_enabled); 2369 is_enabled);
2366 } 2370 }
2367 2371
2368 } // namespace extensions 2372 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698