Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / common / api / sockets / sockets_manifest_data.h
blobac6d6cae6c0281df773580f4747849dd2e424d60
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_API_SOCKETS_SOCKETS_MANIFEST_DATA_H_
6 #define EXTENSIONS_COMMON_API_SOCKETS_SOCKETS_MANIFEST_DATA_H_
8 #include <vector>
10 #include "base/strings/string16.h"
11 #include "extensions/common/extension.h"
12 #include "extensions/common/manifest_handler.h"
14 namespace content {
15 struct SocketPermissionRequest;
18 namespace extensions {
19 class SocketsManifestPermission;
22 namespace extensions {
24 // The parsed form of the "sockets" manifest entry.
25 class SocketsManifestData : public Extension::ManifestData {
26 public:
27 explicit SocketsManifestData(
28 scoped_ptr<SocketsManifestPermission> permission);
29 virtual ~SocketsManifestData();
31 // Gets the SocketsManifestData for |extension|, or NULL if none was
32 // specified.
33 static SocketsManifestData* Get(const Extension* extension);
35 static bool CheckRequest(const Extension* extension,
36 const content::SocketPermissionRequest& request);
38 // Tries to construct the info based on |value|, as it would have appeared in
39 // the manifest. Sets |error| and returns an empty scoped_ptr on failure.
40 static scoped_ptr<SocketsManifestData> FromValue(const base::Value& value,
41 base::string16* error);
43 const SocketsManifestPermission* permission() const {
44 return permission_.get();
47 private:
48 scoped_ptr<SocketsManifestPermission> permission_;
51 } // namespace extensions
53 #endif // EXTENSIONS_COMMON_API_SOCKETS_SOCKETS_MANIFEST_DATA_H_