Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / common / permissions / media_galleries_permission_data.h
blob920a90506c81b3c29ed89f56e31ce3c0f673ea45
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_MEDIA_GALLERIES_PERMISSION_DATA_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "extensions/common/permissions/api_permission.h"
14 namespace base {
15 class Value;
18 namespace extensions {
20 // A MediaGalleriesPermissionData instance represents a single part of the
21 // MediaGalleriesPermission. e.g. "read" or "allAutoDetected".
22 class MediaGalleriesPermissionData {
23 public:
24 MediaGalleriesPermissionData();
26 // Check if |param| (which must be a MediaGalleriesPermission::CheckParam)
27 // matches the encapsulated attribute.
28 bool Check(const APIPermission::CheckParam* param) const;
30 // Convert |this| into a base::Value.
31 scoped_ptr<base::Value> ToValue() const;
33 // Populate |this| from a base::Value.
34 bool FromValue(const base::Value* value);
36 bool operator<(const MediaGalleriesPermissionData& rhs) const;
37 bool operator==(const MediaGalleriesPermissionData& rhs) const;
39 std::string permission() const { return permission_; }
41 // This accessor is provided for IPC_STRUCT_TRAITS_MEMBER. Please think
42 // twice before using it for anything else.
43 std::string& permission() { return permission_; }
45 private:
46 std::string permission_;
49 } // namespace extensions
51 #endif // EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_