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

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: Replaced include with forward declaration Created 7 years, 8 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
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 continue; 1143 continue;
1144 bool writable = false; 1144 bool writable = false;
1145 if (!file_entry->GetBoolean(kFileEntryWritable, &writable)) 1145 if (!file_entry->GetBoolean(kFileEntryWritable, &writable))
1146 continue; 1146 continue;
1147 base::FilePath file_path(path_string); 1147 base::FilePath file_path(path_string);
1148 out->push_back(app_file_handler_util::SavedFileEntry( 1148 out->push_back(app_file_handler_util::SavedFileEntry(
1149 it.key(), file_path, writable)); 1149 it.key(), file_path, writable));
1150 } 1150 }
1151 } 1151 }
1152 1152
1153 ExtensionOmniboxSuggestion 1153 scoped_ptr<api::omnibox::SuggestResult>
1154 ExtensionPrefs::GetOmniboxDefaultSuggestion(const std::string& extension_id) { 1154 ExtensionPrefs::GetOmniboxDefaultSuggestion(const std::string& extension_id) {
1155 ExtensionOmniboxSuggestion suggestion; 1155 scoped_ptr<api::omnibox::SuggestResult> suggestion;
1156 1156
1157 const DictionaryValue* extension = GetExtensionPref(extension_id); 1157 const DictionaryValue* extension = GetExtensionPref(extension_id);
1158 const DictionaryValue* dict = NULL; 1158 const DictionaryValue* dict = NULL;
1159 if (extension && extension->GetDictionary(kOmniboxDefaultSuggestion, &dict)) 1159 if (extension && extension->GetDictionary(kOmniboxDefaultSuggestion, &dict)) {
1160 suggestion.Populate(*dict, false); 1160 suggestion.reset(new api::omnibox::SuggestResult);
1161 api::omnibox::SuggestResult::Populate(*dict, suggestion.get());
1162 }
1161 1163
1162 return suggestion; 1164 return suggestion.Pass();
1163 } 1165 }
1164 1166
1165 void ExtensionPrefs::SetOmniboxDefaultSuggestion( 1167 void ExtensionPrefs::SetOmniboxDefaultSuggestion(
1166 const std::string& extension_id, 1168 const std::string& extension_id,
1167 const ExtensionOmniboxSuggestion& suggestion) { 1169 const api::omnibox::SuggestResult& suggestion) {
1168 scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue().Pass(); 1170 scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue();
1171 // A default suggestion should not have the content field set.
1172 dict->Remove("content", NULL);
1169 UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion, dict.release()); 1173 UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion, dict.release());
1170 } 1174 }
1171 1175
1172 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) { 1176 bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) {
1173 return ReadExtensionPrefBoolean(extension_id, kPrefIncognitoEnabled); 1177 return ReadExtensionPrefBoolean(extension_id, kPrefIncognitoEnabled);
1174 } 1178 }
1175 1179
1176 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id, 1180 void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id,
1177 bool enabled) { 1181 bool enabled) {
1178 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled, 1182 UpdateExtensionPref(extension_id, kPrefIncognitoEnabled,
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 is_enabled = initial_state == Extension::ENABLED; 2376 is_enabled = initial_state == Extension::ENABLED;
2373 } 2377 }
2374 2378
2375 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 2379 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
2376 is_enabled); 2380 is_enabled);
2377 content_settings_store_->RegisterExtension(extension_id, install_time, 2381 content_settings_store_->RegisterExtension(extension_id, install_time,
2378 is_enabled); 2382 is_enabled);
2379 } 2383 }
2380 2384
2381 } // namespace extensions 2385 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698