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

Side by Side Diff: extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc

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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/api/guest_view/extension_view/extension_view_intern al_api.h" 5 #include "extensions/browser/api/guest_view/extension_view/extension_view_intern al_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 std::string extension_id = src.host(); 44 std::string extension_id = src.host();
45 if (!crx_file::id_util::IdIsValid(extension_id) || 45 if (!crx_file::id_util::IdIsValid(extension_id) ||
46 !IsExtensionIdWhitelisted(extension_id)) 46 !IsExtensionIdWhitelisted(extension_id))
47 return false; 47 return false;
48 48
49 return true; 49 return true;
50 } 50 }
51 51
52 bool ExtensionViewInternalLoadSrcFunction::RunAsyncSafe( 52 bool ExtensionViewInternalLoadSrcFunction::RunAsyncSafe(
53 ExtensionViewGuest* guest) { 53 ExtensionViewGuest* guest) {
54 scoped_ptr<extensionview::LoadSrc::Params> params( 54 std::unique_ptr<extensionview::LoadSrc::Params> params(
55 extensionview::LoadSrc::Params::Create(*args_)); 55 extensionview::LoadSrc::Params::Create(*args_));
56 EXTENSION_FUNCTION_VALIDATE(params.get()); 56 EXTENSION_FUNCTION_VALIDATE(params.get());
57 std::string src = params->src; 57 std::string src = params->src;
58 GURL url(src); 58 GURL url(src);
59 bool has_load_succeeded = false; 59 bool has_load_succeeded = false;
60 bool is_src_valid = IsSrcValid(url); 60 bool is_src_valid = IsSrcValid(url);
61 61
62 if (is_src_valid) 62 if (is_src_valid)
63 has_load_succeeded = guest->NavigateGuest(src, true /* force_navigation */); 63 has_load_succeeded = guest->NavigateGuest(src, true /* force_navigation */);
64 64
65 // Return whether load is successful. 65 // Return whether load is successful.
66 SetResult(new base::FundamentalValue(has_load_succeeded)); 66 SetResult(new base::FundamentalValue(has_load_succeeded));
67 SendResponse(true); 67 SendResponse(true);
68 return true; 68 return true;
69 } 69 }
70 70
71 bool ExtensionViewInternalParseSrcFunction::RunAsync() { 71 bool ExtensionViewInternalParseSrcFunction::RunAsync() {
72 scoped_ptr<extensionview::ParseSrc::Params> params( 72 std::unique_ptr<extensionview::ParseSrc::Params> params(
73 extensionview::ParseSrc::Params::Create(*args_)); 73 extensionview::ParseSrc::Params::Create(*args_));
74 EXTENSION_FUNCTION_VALIDATE(params.get()); 74 EXTENSION_FUNCTION_VALIDATE(params.get());
75 GURL url(params->src); 75 GURL url(params->src);
76 bool is_src_valid = IsSrcValid(url); 76 bool is_src_valid = IsSrcValid(url);
77 77
78 // Return whether the src is valid and the current extension ID to 78 // Return whether the src is valid and the current extension ID to
79 // the callback. 79 // the callback.
80 scoped_ptr<base::ListValue> result_list(new base::ListValue()); 80 std::unique_ptr<base::ListValue> result_list(new base::ListValue());
81 result_list->AppendBoolean(is_src_valid); 81 result_list->AppendBoolean(is_src_valid);
82 result_list->AppendString(url.host()); 82 result_list->AppendString(url.host());
83 SetResultList(std::move(result_list)); 83 SetResultList(std::move(result_list));
84 SendResponse(true); 84 SendResponse(true);
85 return true; 85 return true;
86 } 86 }
87 87
88 } // namespace extensions 88 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698