Home | History | Annotate | Download | only in permissions
      1 // Copyright 2013 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.
      4 
      5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_SETTINGS_OVERRIDE_PERMISSION_H_
      6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_SETTINGS_OVERRIDE_PERMISSION_H_
      7 
      8 #include <string>
      9 
     10 #include "extensions/common/permissions/api_permission.h"
     11 
     12 namespace extensions {
     13 
     14 // Takes care of creating custom permission messages for extensions that
     15 // override settings.
     16 class SettingsOverrideAPIPermission : public APIPermission {
     17  public:
     18   SettingsOverrideAPIPermission(
     19       const APIPermissionInfo* permission, const std::string& setting_value);
     20   virtual ~SettingsOverrideAPIPermission();
     21 
     22   // APIPermission overrides.
     23   virtual bool HasMessages() const OVERRIDE;
     24   virtual PermissionMessages GetMessages() const OVERRIDE;
     25   virtual bool Check(const APIPermission::CheckParam* param) const OVERRIDE;
     26   virtual bool Contains(const APIPermission* rhs) const OVERRIDE;
     27   virtual bool Equal(const APIPermission* rhs) const OVERRIDE;
     28   virtual bool FromValue(const base::Value* value) OVERRIDE;
     29   virtual scoped_ptr<base::Value> ToValue() const OVERRIDE;
     30   virtual APIPermission* Clone() const OVERRIDE;
     31   virtual APIPermission* Diff(const APIPermission* rhs) const OVERRIDE;
     32   virtual APIPermission* Union(const APIPermission* rhs) const OVERRIDE;
     33   virtual APIPermission* Intersect(const APIPermission* rhs) const OVERRIDE;
     34   virtual void Write(IPC::Message* m) const OVERRIDE;
     35   virtual bool Read(const IPC::Message* m, PickleIterator* iter) OVERRIDE;
     36   virtual void Log(std::string* log) const OVERRIDE;
     37 
     38  private:
     39   std::string setting_value_;
     40 };
     41 
     42 }  // namespace extensions
     43 
     44 #endif  // CHROME_COMMON_EXTENSIONS_PERMISSIONS_SETTINGS_OVERRIDE_PERMISSION_H_
     45