1 // Copyright 2014 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/app_view/app_view_internal_api.h"
7 #include "extensions/browser/guest_view/app_view/app_view_guest.h"
8 #include "extensions/common/api/app_view_internal.h"
11 namespace extensions {
13 namespace appview = core_api::app_view_internal;
15 AppViewInternalAttachFrameFunction::
16 AppViewInternalAttachFrameFunction() {
19 bool AppViewInternalAttachFrameFunction::RunAsync() {
20 scoped_ptr<appview::AttachFrame::Params> params(
21 appview::AttachFrame::Params::Create(*args_));
22 EXTENSION_FUNCTION_VALIDATE(params.get());
24 GURL url = extension()->GetResourceURL(params->url);
25 EXTENSION_FUNCTION_VALIDATE(url.is_valid());
27 return AppViewGuest::CompletePendingRequest(browser_context(),
29 params->guest_instance_id,
33 AppViewInternalDenyRequestFunction::
34 AppViewInternalDenyRequestFunction() {
37 bool AppViewInternalDenyRequestFunction::RunAsync() {
38 scoped_ptr<appview::DenyRequest::Params> params(
39 appview::DenyRequest::Params::Create(*args_));
40 EXTENSION_FUNCTION_VALIDATE(params.get());
42 // Since the URL passed into AppViewGuest:::CompletePendingRequest is invalid,
43 // a new <appview> WebContents will not be created.
44 return AppViewGuest::CompletePendingRequest(browser_context(),
46 params->guest_instance_id,
50 } // namespace extensions