Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / extensions / common / permissions / settings_override_permission.h
blob90dc2cc3a33f3ee793b4bcca4cd7912304553075
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_SETTINGS_OVERRIDE_PERMISSION_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_SETTINGS_OVERRIDE_PERMISSION_H_
8 #include <string>
10 #include "extensions/common/permissions/api_permission.h"
12 namespace extensions {
14 // Takes care of creating custom permission messages for extensions that
15 // override settings.
16 class SettingsOverrideAPIPermission : public APIPermission {
17 public:
18 SettingsOverrideAPIPermission(const APIPermissionInfo* permission,
19 const std::string& setting_value);
20 ~SettingsOverrideAPIPermission() override;
22 // APIPermission overrides.
23 bool HasMessages() const override;
24 PermissionMessages GetMessages() const override;
25 bool Check(const APIPermission::CheckParam* param) const override;
26 bool Contains(const APIPermission* rhs) const override;
27 bool Equal(const APIPermission* rhs) const override;
28 bool FromValue(const base::Value* value,
29 std::string* error,
30 std::vector<std::string>* unhandled_permissions) override;
31 scoped_ptr<base::Value> ToValue() const override;
32 APIPermission* Clone() const override;
33 APIPermission* Diff(const APIPermission* rhs) const override;
34 APIPermission* Union(const APIPermission* rhs) const override;
35 APIPermission* Intersect(const APIPermission* rhs) const override;
36 void Write(IPC::Message* m) const override;
37 bool Read(const IPC::Message* m, PickleIterator* iter) override;
38 void Log(std::string* log) const override;
40 private:
41 std::string setting_value_;
44 } // namespace extensions
46 #endif // EXTENSIONS_COMMON_PERMISSIONS_SETTINGS_OVERRIDE_PERMISSION_H_