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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFEST_H _ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFEST_H _
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFEST_H _ 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFEST_H _
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "extensions/common/url_pattern_set.h" 13 #include "extensions/common/url_pattern_set.h"
14 14
15 namespace base { 15 namespace base {
16 class DictionaryValue; 16 class DictionaryValue;
17 } 17 }
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 class NativeMessagingHostManifest { 21 class NativeMessagingHostManifest {
22 public: 22 public:
23 enum HostInterface { 23 enum HostInterface {
24 HOST_INTERFACE_STDIO, 24 HOST_INTERFACE_STDIO,
25 }; 25 };
26 26
27 ~NativeMessagingHostManifest(); 27 ~NativeMessagingHostManifest();
28 28
29 // Verifies that the name is valid. Valid names must match regular expression 29 // Verifies that the name is valid. Valid names must match regular expression
30 // "([a-z0-9_]+.)*[a-z0-9_]+". 30 // "([a-z0-9_]+.)*[a-z0-9_]+".
31 static bool IsValidName(const std::string& name); 31 static bool IsValidName(const std::string& name);
32 32
33 // Load manifest file from |file_path|. 33 // Load manifest file from |file_path|.
34 static scoped_ptr<NativeMessagingHostManifest> Load( 34 static std::unique_ptr<NativeMessagingHostManifest> Load(
35 const base::FilePath& file_path, 35 const base::FilePath& file_path,
36 std::string* error_message); 36 std::string* error_message);
37 37
38 const std::string& name() const { return name_; } 38 const std::string& name() const { return name_; }
39 const std::string& description() const { return description_; } 39 const std::string& description() const { return description_; }
40 HostInterface interface() const { return interface_; } 40 HostInterface interface() const { return interface_; }
41 const base::FilePath& path() const { return path_; } 41 const base::FilePath& path() const { return path_; }
42 const URLPatternSet& allowed_origins() const { return allowed_origins_; } 42 const URLPatternSet& allowed_origins() const { return allowed_origins_; }
43 43
44 private: 44 private:
45 NativeMessagingHostManifest(); 45 NativeMessagingHostManifest();
46 46
47 // Parses manifest |dictionary|. In case of an error sets |error_message| and 47 // Parses manifest |dictionary|. In case of an error sets |error_message| and
48 // returns false. 48 // returns false.
49 bool Parse(base::DictionaryValue* dictionary, std::string* error_message); 49 bool Parse(base::DictionaryValue* dictionary, std::string* error_message);
50 50
51 std::string name_; 51 std::string name_;
52 std::string description_; 52 std::string description_;
53 HostInterface interface_; 53 HostInterface interface_;
54 base::FilePath path_; 54 base::FilePath path_;
55 URLPatternSet allowed_origins_; 55 URLPatternSet allowed_origins_;
56 56
57 DISALLOW_COPY_AND_ASSIGN(NativeMessagingHostManifest); 57 DISALLOW_COPY_AND_ASSIGN(NativeMessagingHostManifest);
58 }; 58 };
59 59
60 } // namespace extensions 60 } // namespace extensions
61 61
62 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFES T_H_ 62 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFES T_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698