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

Unified Diff: chrome/browser/extensions/api/module/module.cc

Issue 15051010: Move [Get|Set]UpdateURLData from ExtensionPrefs to ExtensionAPI (aka Module) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Android Gypi Created 7 years, 7 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/api/module/module.h ('k') | chrome/browser/extensions/extension_prefs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/module/module.cc
diff --git a/chrome/browser/extensions/api/module/module.cc b/chrome/browser/extensions/api/module/module.cc
index 908661039db7161aca699a2f7948d58091db9e67..d9c11b77b45edcf1bb9fdd9b3abf1cdc6ce860e1 100644
--- a/chrome/browser/extensions/api/module/module.cc
+++ b/chrome/browser/extensions/api/module/module.cc
@@ -6,26 +6,48 @@
#include <string>
+#include "base/values.h"
#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.h"
namespace extensions {
-ExtensionPrefs* ExtensionSetUpdateUrlDataFunction::extension_prefs() {
- return profile()->GetExtensionService()->extension_prefs();
+namespace extension {
+
+namespace {
+
+// A preference for storing the extension's update URL data. If not empty, the
+// the ExtensionUpdater will append a ap= parameter to the URL when checking if
+// a new version of the extension is available.
+const char kUpdateURLData[] = "update_url_data";
+
+} // namespace
+
+std::string GetUpdateURLData(const ExtensionPrefs* prefs,
+ const std::string& extension_id) {
+ std::string data;
+ prefs->ReadPrefAsString(extension_id, kUpdateURLData, &data);
+ return data;
}
+} // namespace extension
+
bool ExtensionSetUpdateUrlDataFunction::RunImpl() {
std::string data;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &data));
- extension_prefs()->SetUpdateUrlData(extension_id(), data);
+ ExtensionPrefs::Get(profile())->UpdateExtensionPref(
+ extension_id(),
+ extension::kUpdateURLData,
+ base::Value::CreateStringValue(data));
return true;
}
bool ExtensionIsAllowedIncognitoAccessFunction::RunImpl() {
- ExtensionService* ext_service = profile()->GetExtensionService();
+ ExtensionService* ext_service =
+ ExtensionSystem::Get(profile())->extension_service();
const Extension* extension = GetExtension();
SetResult(Value::CreateBooleanValue(
@@ -34,7 +56,8 @@ bool ExtensionIsAllowedIncognitoAccessFunction::RunImpl() {
}
bool ExtensionIsAllowedFileSchemeAccessFunction::RunImpl() {
- ExtensionService* ext_service = profile()->GetExtensionService();
+ ExtensionService* ext_service =
+ ExtensionSystem::Get(profile())->extension_service();
const Extension* extension = GetExtension();
SetResult(Value::CreateBooleanValue(
« no previous file with comments | « chrome/browser/extensions/api/module/module.h ('k') | chrome/browser/extensions/extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698