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

Side by Side Diff: chrome/browser/extensions/install_signer.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 2013 The Chromium Authors. All rights reserved. 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 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_INSTALL_SIGNER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_SIGNER_H_
6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_SIGNER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_SIGNER_H_
7 7
8 #include <memory>
8 #include <set> 9 #include <set>
9 #include <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "extensions/common/extension.h" 15 #include "extensions/common/extension.h"
16 16
17 namespace base { 17 namespace base {
18 class DictionaryValue; 18 class DictionaryValue;
19 } 19 }
20 20
21 namespace net { 21 namespace net {
22 class URLFetcher; 22 class URLFetcher;
23 class URLRequestContextGetter; 23 class URLRequestContextGetter;
24 } 24 }
(...skipping 21 matching lines...) Expand all
46 // Note that this is computed locally and *not* signed by the signature. 46 // Note that this is computed locally and *not* signed by the signature.
47 ExtensionIdSet invalid_ids; 47 ExtensionIdSet invalid_ids;
48 48
49 InstallSignature(); 49 InstallSignature();
50 InstallSignature(const InstallSignature& other); 50 InstallSignature(const InstallSignature& other);
51 ~InstallSignature(); 51 ~InstallSignature();
52 52
53 // Helper methods for serialization to/from a base::DictionaryValue. 53 // Helper methods for serialization to/from a base::DictionaryValue.
54 void ToValue(base::DictionaryValue* value) const; 54 void ToValue(base::DictionaryValue* value) const;
55 55
56 static scoped_ptr<InstallSignature> FromValue( 56 static std::unique_ptr<InstallSignature> FromValue(
57 const base::DictionaryValue& value); 57 const base::DictionaryValue& value);
58 }; 58 };
59 59
60 // Objects of this class encapsulate an operation to get a signature proving 60 // Objects of this class encapsulate an operation to get a signature proving
61 // that a set of ids are hosted in the webstore. 61 // that a set of ids are hosted in the webstore.
62 class InstallSigner { 62 class InstallSigner {
63 public: 63 public:
64 typedef base::Callback<void(scoped_ptr<InstallSignature>)> SignatureCallback; 64 typedef base::Callback<void(std::unique_ptr<InstallSignature>)>
65 SignatureCallback;
65 66
66 // IMPORTANT NOTE: It is possible that only some, but not all, of the entries 67 // IMPORTANT NOTE: It is possible that only some, but not all, of the entries
67 // in |ids| will be successfully signed by the backend. Callers should always 68 // in |ids| will be successfully signed by the backend. Callers should always
68 // check the set of ids in the InstallSignature passed to their callback, as 69 // check the set of ids in the InstallSignature passed to their callback, as
69 // it may contain only a subset of the ids they passed in. 70 // it may contain only a subset of the ids they passed in.
70 InstallSigner(net::URLRequestContextGetter* context_getter, 71 InstallSigner(net::URLRequestContextGetter* context_getter,
71 const ExtensionIdSet& ids); 72 const ExtensionIdSet& ids);
72 ~InstallSigner(); 73 ~InstallSigner();
73 74
74 // Returns a set of ids that are forced to be considered not from webstore, 75 // Returns a set of ids that are forced to be considered not from webstore,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // The current set of ids we're trying to verify. This may contain fewer ids 109 // The current set of ids we're trying to verify. This may contain fewer ids
109 // than we started with. 110 // than we started with.
110 ExtensionIdSet ids_; 111 ExtensionIdSet ids_;
111 112
112 // An array of random bytes used as an input to hash with the machine id, 113 // An array of random bytes used as an input to hash with the machine id,
113 // which will need to be persisted in the eventual InstallSignature we get. 114 // which will need to be persisted in the eventual InstallSignature we get.
114 std::string salt_; 115 std::string salt_;
115 116
116 // These are used to make the call to a backend server for a signature. 117 // These are used to make the call to a backend server for a signature.
117 net::URLRequestContextGetter* context_getter_; 118 net::URLRequestContextGetter* context_getter_;
118 scoped_ptr<net::URLFetcher> url_fetcher_; 119 std::unique_ptr<net::URLFetcher> url_fetcher_;
119 scoped_ptr<FetcherDelegate> delegate_; 120 std::unique_ptr<FetcherDelegate> delegate_;
120 121
121 // The time the request to the server was started. 122 // The time the request to the server was started.
122 base::Time request_start_time_; 123 base::Time request_start_time_;
123 124
124 DISALLOW_COPY_AND_ASSIGN(InstallSigner); 125 DISALLOW_COPY_AND_ASSIGN(InstallSigner);
125 }; 126 };
126 127
127 } // namespace extensions 128 } // namespace extensions
128 129
129 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_SIGNER_H_ 130 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_SIGNER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/global_shortcut_listener_win.h ('k') | chrome/browser/extensions/install_signer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698