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.
5 #include "extensions/browser/api/guest_view/extension_view/extension_view_internal_api.h"
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"
16 namespace extensionview
= extensions::core_api::extension_view_internal
;
18 namespace extensions
{
20 bool ExtensionViewInternalExtensionFunction::RunAsync() {
22 EXTENSION_FUNCTION_VALIDATE(args_
->GetInteger(0, &instance_id
));
23 ExtensionViewGuest
* guest
= ExtensionViewGuest::From(
24 render_view_host()->GetProcess()->GetID(), instance_id
);
27 return RunAsyncSafe(guest
);
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 */);
40 } // namespace extensions