Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Side by Side Diff: chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h

Issue 12285015: Require manifests for native messaging hosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 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_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFEST_H _
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFEST_H _
7
8 #include <set>
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/file_path.h"
13 #include "base/memory/scoped_ptr.h"
14
15 namespace base {
16 class DictionaryValue;
17 }
18
19 namespace extensions {
20
21 class NativeMessagingHostManifest {
22 public:
23 enum HostInterface {
24 HOST_INTERFACE_STDIO,
25 };
26
27 ~NativeMessagingHostManifest();
28
29 // Load manifest file from |file_path|.
30 static scoped_ptr<NativeMessagingHostManifest> Load(
31 const FilePath& file_path,
32 std::string* error_message);
33
34 const std::string& name() { return name_; }
35 const std::string& description() { return description_; }
36 HostInterface interface() { return interface_; }
37 FilePath& path() { return path_; }
38 bool IsAllowedOrigin(const std::string& origin);
39
40 private:
41 NativeMessagingHostManifest();
42
43 // Parses manifest |dictionary|. In case of an error sets |error_message| and
44 // returns false.
45 bool Parse(base::DictionaryValue* dictionary, std::string* error_message);
46
47 std::string name_;
48 std::string description_;
49 HostInterface interface_;
50 FilePath path_;
51 std::set<std::string> allowed_origins_;
52
53 DISALLOW_COPY_AND_ASSIGN(NativeMessagingHostManifest);
54 };
55
56 } // namespace extensions
57
58 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFES T_H_
59
60
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698