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

Side by Side Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.h

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_ATTRI BUTE_H_ 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_ATTRI BUTE_H_
6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_ATTRI BUTE_H_ 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_ATTRI BUTE_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "content/public/common/resource_type.h" 14 #include "content/public/common/resource_type.h"
15 #include "extensions/browser/api/declarative_webrequest/request_stage.h" 15 #include "extensions/browser/api/declarative_webrequest/request_stage.h"
16 #include "extensions/common/api/events.h" 16 #include "extensions/common/api/events.h"
17 17
18 namespace base { 18 namespace base {
19 class Value; 19 class Value;
20 } 20 }
21 21
22 namespace net { 22 namespace net {
23 class URLRequest; 23 class URLRequest;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 // Implementation of WebRequestConditionAttribute: 161 // Implementation of WebRequestConditionAttribute:
162 int GetStages() const override; 162 int GetStages() const override;
163 bool IsFulfilled(const WebRequestData& request_data) const override; 163 bool IsFulfilled(const WebRequestData& request_data) const override;
164 Type GetType() const override; 164 Type GetType() const override;
165 std::string GetName() const override; 165 std::string GetName() const override;
166 bool Equals(const WebRequestConditionAttribute* other) const override; 166 bool Equals(const WebRequestConditionAttribute* other) const override;
167 167
168 private: 168 private:
169 WebRequestConditionAttributeRequestHeaders( 169 WebRequestConditionAttributeRequestHeaders(
170 scoped_ptr<const HeaderMatcher> header_matcher, bool positive); 170 std::unique_ptr<const HeaderMatcher> header_matcher,
171 bool positive);
171 ~WebRequestConditionAttributeRequestHeaders() override; 172 ~WebRequestConditionAttributeRequestHeaders() override;
172 173
173 const scoped_ptr<const HeaderMatcher> header_matcher_; 174 const std::unique_ptr<const HeaderMatcher> header_matcher_;
174 const bool positive_; 175 const bool positive_;
175 176
176 DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeRequestHeaders); 177 DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeRequestHeaders);
177 }; 178 };
178 179
179 // Condition attribute for matching against response headers. Uses HeaderMatcher 180 // Condition attribute for matching against response headers. Uses HeaderMatcher
180 // to handle the actual tests, in connection with a boolean positiveness 181 // to handle the actual tests, in connection with a boolean positiveness
181 // flag. If that flag is set to true, then IsFulfilled() returns true iff 182 // flag. If that flag is set to true, then IsFulfilled() returns true iff
182 // |header_matcher_| matches at least one header. Otherwise IsFulfilled() 183 // |header_matcher_| matches at least one header. Otherwise IsFulfilled()
183 // returns true iff the |header_matcher_| matches no header. 184 // returns true iff the |header_matcher_| matches no header.
184 class WebRequestConditionAttributeResponseHeaders 185 class WebRequestConditionAttributeResponseHeaders
185 : public WebRequestConditionAttribute { 186 : public WebRequestConditionAttribute {
186 public: 187 public:
187 // Factory method, see WebRequestConditionAttribute::Create. 188 // Factory method, see WebRequestConditionAttribute::Create.
188 static scoped_refptr<const WebRequestConditionAttribute> Create( 189 static scoped_refptr<const WebRequestConditionAttribute> Create(
189 const std::string& name, 190 const std::string& name,
190 const base::Value* value, 191 const base::Value* value,
191 std::string* error, 192 std::string* error,
192 bool* bad_message); 193 bool* bad_message);
193 194
194 // Implementation of WebRequestConditionAttribute: 195 // Implementation of WebRequestConditionAttribute:
195 int GetStages() const override; 196 int GetStages() const override;
196 bool IsFulfilled(const WebRequestData& request_data) const override; 197 bool IsFulfilled(const WebRequestData& request_data) const override;
197 Type GetType() const override; 198 Type GetType() const override;
198 std::string GetName() const override; 199 std::string GetName() const override;
199 bool Equals(const WebRequestConditionAttribute* other) const override; 200 bool Equals(const WebRequestConditionAttribute* other) const override;
200 201
201 private: 202 private:
202 WebRequestConditionAttributeResponseHeaders( 203 WebRequestConditionAttributeResponseHeaders(
203 scoped_ptr<const HeaderMatcher> header_matcher, bool positive); 204 std::unique_ptr<const HeaderMatcher> header_matcher,
205 bool positive);
204 ~WebRequestConditionAttributeResponseHeaders() override; 206 ~WebRequestConditionAttributeResponseHeaders() override;
205 207
206 const scoped_ptr<const HeaderMatcher> header_matcher_; 208 const std::unique_ptr<const HeaderMatcher> header_matcher_;
207 const bool positive_; 209 const bool positive_;
208 210
209 DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeResponseHeaders); 211 DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeResponseHeaders);
210 }; 212 };
211 213
212 // This condition tests whether the request origin is third-party. 214 // This condition tests whether the request origin is third-party.
213 class WebRequestConditionAttributeThirdParty 215 class WebRequestConditionAttributeThirdParty
214 : public WebRequestConditionAttribute { 216 : public WebRequestConditionAttribute {
215 public: 217 public:
216 // Factory method, see WebRequestConditionAttribute::Create. 218 // Factory method, see WebRequestConditionAttribute::Create.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 ~WebRequestConditionAttributeStages() override; 262 ~WebRequestConditionAttributeStages() override;
261 263
262 const int allowed_stages_; // Composition of RequestStage values. 264 const int allowed_stages_; // Composition of RequestStage values.
263 265
264 DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeStages); 266 DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeStages);
265 }; 267 };
266 268
267 } // namespace extensions 269 } // namespace extensions
268 270
269 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_AT TRIBUTE_H_ 271 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_AT TRIBUTE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698