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

Unified Diff: chrome/browser/extensions/settings/settings_api.cc

Issue 10829142: Disable the managed storage API behind a flag for M22. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years, 4 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 | « no previous file | chrome/browser/extensions/settings/settings_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/settings/settings_api.cc
diff --git a/chrome/browser/extensions/settings/settings_api.cc b/chrome/browser/extensions/settings/settings_api.cc
index ac98a2ade948f72f7bbcfaa70477e03f4b2eedfb..7cf459a822d7d24245b49a31570fccce1fcbe847 100644
--- a/chrome/browser/extensions/settings/settings_api.cc
+++ b/chrome/browser/extensions/settings/settings_api.cc
@@ -8,12 +8,14 @@
#include <vector>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extensions_quota_service.h"
#include "chrome/browser/extensions/settings/settings_frontend.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/storage.h"
#include "content/public/browser/browser_thread.h"
@@ -25,6 +27,8 @@ namespace {
const char kUnsupportedArgumentType[] = "Unsupported argument type";
const char kInvalidNamespaceErrorMessage[] =
"\"%s\" is not available in this instance of Chrome";
+const char kManagedNamespaceDisabledErrorMessage[] =
+ "\"managed\" is disabled. Use \"--%s\" to enable it.";
const char kStorageErrorMessage[] = "Storage error";
} // namespace
@@ -55,6 +59,16 @@ bool SettingsFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(
settings_namespace_ != settings_namespace::INVALID);
+ // TODO(joaodasilva): remove this flag once policy for extensions works on
+ // mac and chromeos. http://crbug.com/108992
+ if (settings_namespace_ == settings_namespace::MANAGED &&
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableManagedStorage)) {
+ error_ = base::StringPrintf(kManagedNamespaceDisabledErrorMessage,
+ switches::kEnableManagedStorage);
+ return false;
+ }
+
SettingsFrontend* frontend =
profile()->GetExtensionService()->settings_frontend();
if (!frontend->IsStorageEnabled(settings_namespace_)) {
« no previous file with comments | « no previous file | chrome/browser/extensions/settings/settings_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698