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

Unified Diff: chrome/browser/extensions/extension_prefs.cc

Issue 10306015: Persist the extension omnibox default suggestion to Prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: empty.list Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_prefs.cc
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index 9ab3412280c34b3160d663931acab9e8d8064de5..180fee382e89e83e295157e37c3f0b3f49030af6 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -8,6 +8,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/api/alarms/alarm_manager.h"
+#include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
#include "chrome/browser/extensions/extension_pref_store.h"
#include "chrome/browser/extensions/extension_sorting.h"
#include "chrome/browser/prefs/pref_notifier.h"
@@ -162,6 +163,9 @@ const char kRegisteredEvents[] = "events";
const char kRegisteredAlarms[] = "alarms";
const char kAlarmScheduledRunTime[] = "scheduled_run_time";
+// Persisted value for omnibox.setDefaultSuggestion.
+const char kOmniboxDefaultSuggestion[] = "omnibox_default_suggestion";
+
// Provider of write access to a dictionary storing extension prefs.
class ScopedExtensionPrefUpdate : public DictionaryPrefUpdate {
public:
@@ -1001,6 +1005,25 @@ void ExtensionPrefs::SetRegisteredAlarms(
UpdateExtensionPref(extension_id, kRegisteredAlarms, list);
}
+extensions::ExtensionOmniboxSuggestion
+ExtensionPrefs::GetOmniboxDefaultSuggestion(const std::string& extension_id) {
+ extensions::ExtensionOmniboxSuggestion suggestion;
+
+ const base::DictionaryValue* extension = GetExtensionPref(extension_id);
+ base::DictionaryValue* dict = NULL;
+ if (extension && extension->GetDictionary(kOmniboxDefaultSuggestion, &dict))
+ suggestion.Populate(*dict, false);
+
+ return suggestion;
+}
+
+void ExtensionPrefs::SetOmniboxDefaultSuggestion(
+ const std::string& extension_id,
+ const extensions::ExtensionOmniboxSuggestion& suggestion) {
+ scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue().Pass();
+ UpdateExtensionPref(extension_id, kOmniboxDefaultSuggestion, dict.release());
+}
+
bool ExtensionPrefs::IsIncognitoEnabled(const std::string& extension_id) {
return ReadExtensionPrefBoolean(extension_id, kPrefIncognitoEnabled);
}
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698