OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "extensions/browser/api/extension_view/extension_view_internal_api.h" |
| 6 |
| 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/browser/render_view_host.h" |
| 11 #include "content/public/browser/storage_partition.h" |
| 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/common/stop_find_action.h" |
| 14 #include "extensions/common/api/extension_view_internal.h" |
| 15 |
| 16 namespace extensionview = extensions::core_api::extension_view_internal; |
| 17 |
| 18 namespace extensions { |
| 19 |
| 20 bool ExtensionViewInternalExtensionFunction::RunAsync() { |
| 21 int instance_id = 0; |
| 22 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); |
| 23 ExtensionViewGuest* guest = ExtensionViewGuest::From( |
| 24 render_view_host()->GetProcess()->GetID(), instance_id); |
| 25 if (!guest) |
| 26 return false; |
| 27 return RunAsyncSafe(guest); |
| 28 } |
| 29 |
| 30 bool ExtensionViewInternalNavigateFunction::RunAsyncSafe( |
| 31 ExtensionViewGuest* guest) { |
| 32 scoped_ptr<extensionview::Navigate::Params> params( |
| 33 extensionview::Navigate::Params::Create(*args_)); |
| 34 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 35 std::string src = params->src; |
| 36 guest->NavigateGuest(src, true /* force_navigation */); |
| 37 return true; |
| 38 } |
| 39 |
| 40 } // namespace extensions |
| 41 |
OLD | NEW |