OLD | NEW |
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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 EXTENSION_FUNCTION_VALIDATE(params.get()); | 57 EXTENSION_FUNCTION_VALIDATE(params.get()); |
58 std::string src = params->src; | 58 std::string src = params->src; |
59 GURL url(src); | 59 GURL url(src); |
60 bool has_load_succeeded = false; | 60 bool has_load_succeeded = false; |
61 bool is_src_valid = IsSrcValid(url); | 61 bool is_src_valid = IsSrcValid(url); |
62 | 62 |
63 if (is_src_valid) | 63 if (is_src_valid) |
64 has_load_succeeded = guest->NavigateGuest(src, true /* force_navigation */); | 64 has_load_succeeded = guest->NavigateGuest(src, true /* force_navigation */); |
65 | 65 |
66 // Return whether load is successful. | 66 // Return whether load is successful. |
67 SetResult(base::MakeUnique<base::FundamentalValue>(has_load_succeeded)); | 67 SetResult(base::MakeUnique<base::Value>(has_load_succeeded)); |
68 SendResponse(true); | 68 SendResponse(true); |
69 return true; | 69 return true; |
70 } | 70 } |
71 | 71 |
72 bool ExtensionViewInternalParseSrcFunction::RunAsync() { | 72 bool ExtensionViewInternalParseSrcFunction::RunAsync() { |
73 std::unique_ptr<extensionview::ParseSrc::Params> params( | 73 std::unique_ptr<extensionview::ParseSrc::Params> params( |
74 extensionview::ParseSrc::Params::Create(*args_)); | 74 extensionview::ParseSrc::Params::Create(*args_)); |
75 EXTENSION_FUNCTION_VALIDATE(params.get()); | 75 EXTENSION_FUNCTION_VALIDATE(params.get()); |
76 GURL url(params->src); | 76 GURL url(params->src); |
77 bool is_src_valid = IsSrcValid(url); | 77 bool is_src_valid = IsSrcValid(url); |
78 | 78 |
79 // Return whether the src is valid and the current extension ID to | 79 // Return whether the src is valid and the current extension ID to |
80 // the callback. | 80 // the callback. |
81 std::unique_ptr<base::ListValue> result_list(new base::ListValue()); | 81 std::unique_ptr<base::ListValue> result_list(new base::ListValue()); |
82 result_list->AppendBoolean(is_src_valid); | 82 result_list->AppendBoolean(is_src_valid); |
83 result_list->AppendString(url.host()); | 83 result_list->AppendString(url.host()); |
84 SetResultList(std::move(result_list)); | 84 SetResultList(std::move(result_list)); |
85 SendResponse(true); | 85 SendResponse(true); |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 } // namespace extensions | 89 } // namespace extensions |
OLD | NEW |