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

Side by Side Diff: extensions/browser/extension_error_test_util.cc

Issue 1909773002: Convert //extensions/browser 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
« no previous file with comments | « extensions/browser/extension_error_test_util.h ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/extension_error_test_util.h" 5 #include "extensions/browser/extension_error_test_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/common/url_constants.h" 10 #include "content/public/common/url_constants.h"
11 #include "extensions/browser/extension_error.h" 11 #include "extensions/browser/extension_error.h"
12 #include "extensions/common/constants.h" 12 #include "extensions/common/constants.h"
13 #include "extensions/common/stack_frame.h" 13 #include "extensions/common/stack_frame.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace extensions { 16 namespace extensions {
17 namespace error_test_util { 17 namespace error_test_util {
18 18
19 namespace { 19 namespace {
20 const char kDefaultStackTrace[] = "function_name (https://url.com:1:1)"; 20 const char kDefaultStackTrace[] = "function_name (https://url.com:1:1)";
21 } 21 }
22 22
23 scoped_ptr<ExtensionError> CreateNewRuntimeError( 23 std::unique_ptr<ExtensionError> CreateNewRuntimeError(
24 const std::string& extension_id, 24 const std::string& extension_id,
25 const std::string& message, 25 const std::string& message,
26 bool from_incognito) { 26 bool from_incognito) {
27 StackTrace stack_trace; 27 StackTrace stack_trace;
28 scoped_ptr<StackFrame> frame = 28 std::unique_ptr<StackFrame> frame =
29 StackFrame::CreateFromText(base::ASCIIToUTF16(kDefaultStackTrace)); 29 StackFrame::CreateFromText(base::ASCIIToUTF16(kDefaultStackTrace));
30 CHECK(frame.get()); 30 CHECK(frame.get());
31 stack_trace.push_back(*frame); 31 stack_trace.push_back(*frame);
32 32
33 base::string16 source = 33 base::string16 source =
34 base::UTF8ToUTF16(std::string(kExtensionScheme) + 34 base::UTF8ToUTF16(std::string(kExtensionScheme) +
35 url::kStandardSchemeSeparator + 35 url::kStandardSchemeSeparator +
36 extension_id); 36 extension_id);
37 37
38 return scoped_ptr<ExtensionError>( 38 return std::unique_ptr<ExtensionError>(
39 new RuntimeError(extension_id, from_incognito, source, 39 new RuntimeError(extension_id, from_incognito, source,
40 base::UTF8ToUTF16(message), stack_trace, 40 base::UTF8ToUTF16(message), stack_trace,
41 GURL::EmptyGURL(), // no context url 41 GURL::EmptyGURL(), // no context url
42 logging::LOG_INFO, 42 logging::LOG_INFO,
43 0, // Render frame id 43 0, // Render frame id
44 0)); // Render process id 44 0)); // Render process id
45 } 45 }
46 46
47 scoped_ptr<ExtensionError> CreateNewRuntimeError( 47 std::unique_ptr<ExtensionError> CreateNewRuntimeError(
48 const std::string& extension_id, const std::string& message) { 48 const std::string& extension_id,
49 const std::string& message) {
49 return CreateNewRuntimeError(extension_id, message, false); 50 return CreateNewRuntimeError(extension_id, message, false);
50 } 51 }
51 52
52 scoped_ptr<ExtensionError> CreateNewManifestError( 53 std::unique_ptr<ExtensionError> CreateNewManifestError(
53 const std::string& extension_id, const std::string& message) { 54 const std::string& extension_id,
54 return scoped_ptr<ExtensionError>( 55 const std::string& message) {
55 new ManifestError(extension_id, 56 return std::unique_ptr<ExtensionError>(
56 base::UTF8ToUTF16(message), 57 new ManifestError(extension_id, base::UTF8ToUTF16(message),
57 base::string16(), 58 base::string16(), base::string16()));
58 base::string16()));
59 } 59 }
60 60
61 } // namespace error_test_util 61 } // namespace error_test_util
62 } // namespace extensions 62 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_error_test_util.h ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698