| 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/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "components/crx_file/id_util.h" | 12 #include "components/crx_file/id_util.h" |
| 12 #include "content/public/browser/render_frame_host.h" | 13 #include "content/public/browser/render_frame_host.h" |
| 13 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 14 #include "content/public/browser/storage_partition.h" | 15 #include "content/public/browser/storage_partition.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/common/stop_find_action.h" | 17 #include "content/public/common/stop_find_action.h" |
| 17 #include "extensions/browser/guest_view/extension_view/whitelist/extension_view_
whitelist.h" | 18 #include "extensions/browser/guest_view/extension_view/whitelist/extension_view_
whitelist.h" |
| 18 #include "extensions/common/api/extension_view_internal.h" | 19 #include "extensions/common/api/extension_view_internal.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 EXTENSION_FUNCTION_VALIDATE(params.get()); | 57 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 57 std::string src = params->src; | 58 std::string src = params->src; |
| 58 GURL url(src); | 59 GURL url(src); |
| 59 bool has_load_succeeded = false; | 60 bool has_load_succeeded = false; |
| 60 bool is_src_valid = IsSrcValid(url); | 61 bool is_src_valid = IsSrcValid(url); |
| 61 | 62 |
| 62 if (is_src_valid) | 63 if (is_src_valid) |
| 63 has_load_succeeded = guest->NavigateGuest(src, true /* force_navigation */); | 64 has_load_succeeded = guest->NavigateGuest(src, true /* force_navigation */); |
| 64 | 65 |
| 65 // Return whether load is successful. | 66 // Return whether load is successful. |
| 66 SetResult(new base::FundamentalValue(has_load_succeeded)); | 67 SetResult(base::MakeUnique<base::FundamentalValue>(has_load_succeeded)); |
| 67 SendResponse(true); | 68 SendResponse(true); |
| 68 return true; | 69 return true; |
| 69 } | 70 } |
| 70 | 71 |
| 71 bool ExtensionViewInternalParseSrcFunction::RunAsync() { | 72 bool ExtensionViewInternalParseSrcFunction::RunAsync() { |
| 72 std::unique_ptr<extensionview::ParseSrc::Params> params( | 73 std::unique_ptr<extensionview::ParseSrc::Params> params( |
| 73 extensionview::ParseSrc::Params::Create(*args_)); | 74 extensionview::ParseSrc::Params::Create(*args_)); |
| 74 EXTENSION_FUNCTION_VALIDATE(params.get()); | 75 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 75 GURL url(params->src); | 76 GURL url(params->src); |
| 76 bool is_src_valid = IsSrcValid(url); | 77 bool is_src_valid = IsSrcValid(url); |
| 77 | 78 |
| 78 // 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 |
| 79 // the callback. | 80 // the callback. |
| 80 std::unique_ptr<base::ListValue> result_list(new base::ListValue()); | 81 std::unique_ptr<base::ListValue> result_list(new base::ListValue()); |
| 81 result_list->AppendBoolean(is_src_valid); | 82 result_list->AppendBoolean(is_src_valid); |
| 82 result_list->AppendString(url.host()); | 83 result_list->AppendString(url.host()); |
| 83 SetResultList(std::move(result_list)); | 84 SetResultList(std::move(result_list)); |
| 84 SendResponse(true); | 85 SendResponse(true); |
| 85 return true; | 86 return true; |
| 86 } | 87 } |
| 87 | 88 |
| 88 } // namespace extensions | 89 } // namespace extensions |
| OLD | NEW |