summaryrefslogtreecommitdiffstats
path: root/extensions/common/permissions
diff options
context:
space:
mode:
authortreib <treib@chromium.org>2015-09-23 16:51:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-23 23:52:01 +0000
commit52653126330fff7788e289c661b877b5be38b48b (patch)
treedd103300b6a7612d6e7a41327c91d018cc6b8789 /extensions/common/permissions
parente7cff0cfc5d68cb766d47c4ac0976de3037ce562 (diff)
downloadchromium_src-52653126330fff7788e289c661b877b5be38b48b.zip
chromium_src-52653126330fff7788e289c661b877b5be38b48b.tar.gz
chromium_src-52653126330fff7788e289c661b877b5be38b48b.tar.bz2
Fix recurring permissions popup for searchProvider permission.
Two parts to this: 1) Define a custom APIPermission constructor for settings override permissions in ChromeAPIPermissions::GetAllPermissions, so that we'll actually get an instance of SettingsOverrideAPIPermission rather than SimpleAPIPermission. 2) Implement SettingsOverrideAPIPermission::ToValue and FromValue, so that the parameter will get stored in and read from prefs. BUG=533086 Review URL: https://codereview.chromium.org/1347043003 Cr-Commit-Position: refs/heads/master@{#350394}
Diffstat (limited to 'extensions/common/permissions')
-rw-r--r--extensions/common/permissions/settings_override_permission.cc12
-rw-r--r--extensions/common/permissions/settings_override_permission.h1
2 files changed, 10 insertions, 3 deletions
diff --git a/extensions/common/permissions/settings_override_permission.cc b/extensions/common/permissions/settings_override_permission.cc
index b4cec3c..f3641bd 100644
--- a/extensions/common/permissions/settings_override_permission.cc
+++ b/extensions/common/permissions/settings_override_permission.cc
@@ -12,6 +12,10 @@
namespace extensions {
SettingsOverrideAPIPermission::SettingsOverrideAPIPermission(
+ const APIPermissionInfo* permission)
+ : APIPermission(permission) {}
+
+SettingsOverrideAPIPermission::SettingsOverrideAPIPermission(
const APIPermissionInfo* permission,
const std::string& setting_value)
: APIPermission(permission), setting_value_(setting_value) {}
@@ -44,11 +48,11 @@ bool SettingsOverrideAPIPermission::FromValue(
const base::Value* value,
std::string* /*error*/,
std::vector<std::string>* unhandled_permissions) {
- return (value == NULL);
+ return value && value->GetAsString(&setting_value_);
}
scoped_ptr<base::Value> SettingsOverrideAPIPermission::ToValue() const {
- return scoped_ptr<base::Value>();
+ return make_scoped_ptr(new base::StringValue(setting_value_));
}
APIPermission* SettingsOverrideAPIPermission::Clone() const {
@@ -80,6 +84,8 @@ bool SettingsOverrideAPIPermission::Read(const IPC::Message* m,
return true;
}
-void SettingsOverrideAPIPermission::Log(std::string* log) const {}
+void SettingsOverrideAPIPermission::Log(std::string* log) const {
+ *log = setting_value_;
+}
} // namespace extensions
diff --git a/extensions/common/permissions/settings_override_permission.h b/extensions/common/permissions/settings_override_permission.h
index 8c0bb00..32dc8b3 100644
--- a/extensions/common/permissions/settings_override_permission.h
+++ b/extensions/common/permissions/settings_override_permission.h
@@ -15,6 +15,7 @@ namespace extensions {
// override settings.
class SettingsOverrideAPIPermission : public APIPermission {
public:
+ explicit SettingsOverrideAPIPermission(const APIPermissionInfo* permission);
SettingsOverrideAPIPermission(const APIPermissionInfo* permission,
const std::string& setting_value);
~SettingsOverrideAPIPermission() override;