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

Side by Side Diff: extensions/common/manifest_handlers/content_capabilities_handler.cc

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? 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 2014 The Chromium Authors. All rights reserved. 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 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 #include "extensions/common/manifest_handlers/content_capabilities_handler.h" 5 #include "extensions/common/manifest_handlers/content_capabilities_handler.h"
6 6
7 #include <memory>
8
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
14 #include "extensions/common/api/extensions_manifest_types.h" 15 #include "extensions/common/api/extensions_manifest_types.h"
15 #include "extensions/common/error_utils.h" 16 #include "extensions/common/error_utils.h"
16 #include "extensions/common/install_warning.h" 17 #include "extensions/common/install_warning.h"
17 #include "extensions/common/manifest_constants.h" 18 #include "extensions/common/manifest_constants.h"
18 #include "extensions/common/permissions/permissions_info.h" 19 #include "extensions/common/permissions/permissions_info.h"
19 #include "extensions/common/url_pattern.h" 20 #include "extensions/common/url_pattern.h"
(...skipping 23 matching lines...) Expand all
43 } 44 }
44 45
45 ContentCapabilitiesHandler::ContentCapabilitiesHandler() { 46 ContentCapabilitiesHandler::ContentCapabilitiesHandler() {
46 } 47 }
47 48
48 ContentCapabilitiesHandler::~ContentCapabilitiesHandler() { 49 ContentCapabilitiesHandler::~ContentCapabilitiesHandler() {
49 } 50 }
50 51
51 bool ContentCapabilitiesHandler::Parse(Extension* extension, 52 bool ContentCapabilitiesHandler::Parse(Extension* extension,
52 base::string16* error) { 53 base::string16* error) {
53 scoped_ptr<ContentCapabilitiesInfo> info(new ContentCapabilitiesInfo); 54 std::unique_ptr<ContentCapabilitiesInfo> info(new ContentCapabilitiesInfo);
54 55
55 const base::Value* value = NULL; 56 const base::Value* value = NULL;
56 if (!extension->manifest()->Get(keys::kContentCapabilities, &value)) { 57 if (!extension->manifest()->Get(keys::kContentCapabilities, &value)) {
57 *error = base::ASCIIToUTF16(errors::kInvalidContentCapabilities); 58 *error = base::ASCIIToUTF16(errors::kInvalidContentCapabilities);
58 return false; 59 return false;
59 } 60 }
60 61
61 scoped_ptr<ContentCapabilities> capabilities(ContentCapabilities::FromValue( 62 std::unique_ptr<ContentCapabilities> capabilities(
62 *value, error)); 63 ContentCapabilities::FromValue(*value, error));
63 if (!capabilities) 64 if (!capabilities)
64 return false; 65 return false;
65 66
66 int supported_schemes = URLPattern::SCHEME_HTTPS; 67 int supported_schemes = URLPattern::SCHEME_HTTPS;
67 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { 68 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
68 // We don't have a suitable HTTPS test server, so this will have to do. 69 // We don't have a suitable HTTPS test server, so this will have to do.
69 supported_schemes |= URLPattern::SCHEME_HTTP; 70 supported_schemes |= URLPattern::SCHEME_HTTP;
70 } 71 }
71 72
72 std::string url_error; 73 std::string url_error;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 extension->SetManifestData(keys::kContentCapabilities, info.release()); 109 extension->SetManifestData(keys::kContentCapabilities, info.release());
109 return true; 110 return true;
110 } 111 }
111 112
112 const std::vector<std::string> ContentCapabilitiesHandler::Keys() 113 const std::vector<std::string> ContentCapabilitiesHandler::Keys()
113 const { 114 const {
114 return SingleKey(keys::kContentCapabilities); 115 return SingleKey(keys::kContentCapabilities);
115 } 116 }
116 117
117 } // namespace extensions 118 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/manifest_handlers/background_info.cc ('k') | extensions/common/manifest_handlers/csp_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698