| Index: extensions/browser/api/app_view/app_view_internal_api.cc
|
| diff --git a/extensions/browser/api/app_view/app_view_internal_api.cc b/extensions/browser/api/app_view/app_view_internal_api.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..564bc89d710cde626c0341f87108cea0a9cc9f15
|
| --- /dev/null
|
| +++ b/extensions/browser/api/app_view/app_view_internal_api.cc
|
| @@ -0,0 +1,61 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "extensions/browser/api/app_view/app_view_internal_api.h"
|
| +
|
| +#include "extensions/browser/extensions_browser_client.h"
|
| +#include "extensions/common/api/app_view_internal.h"
|
| +
|
| +
|
| +namespace extensions {
|
| +
|
| +namespace appview = core_api::app_view_internal;
|
| +
|
| +AppViewInternalAttachFrameFunction::
|
| + AppViewInternalAttachFrameFunction() {
|
| +}
|
| +
|
| +bool AppViewInternalAttachFrameFunction::RunAsync() {
|
| + scoped_ptr<appview::AttachFrame::Params> params(
|
| + appview::AttachFrame::Params::Create(*args_));
|
| + EXTENSION_FUNCTION_VALIDATE(params.get());
|
| +
|
| + GURL url = GetExtension()->GetResourceURL(params->url);
|
| + EXTENSION_FUNCTION_VALIDATE(url.is_valid());
|
| +
|
| + extensions::ExtensionsBrowserClient* extensions_client =
|
| + extensions::ExtensionsBrowserClient::Get();
|
| + if (!extensions_client->CompletePendingEmbedRequest(url,
|
| + params->guest_instance_id,
|
| + browser_context(),
|
| + extension_id())) {
|
| + return false;
|
| + }
|
| +
|
| + return true;
|
| +}
|
| +
|
| +AppViewInternalDenyRequestFunction::
|
| + AppViewInternalDenyRequestFunction() {
|
| +}
|
| +
|
| +bool AppViewInternalDenyRequestFunction::RunAsync() {
|
| + scoped_ptr<appview::DenyRequest::Params> params(
|
| + appview::DenyRequest::Params::Create(*args_));
|
| + EXTENSION_FUNCTION_VALIDATE(params.get());
|
| +
|
| + extensions::ExtensionsBrowserClient* extensions_client =
|
| + extensions::ExtensionsBrowserClient::Get();
|
| + // Since the URL passed into AppViewGuest:::CompletePendingRequest is invalid,
|
| + // a new <appview> WebContents will not be created.
|
| + if (!extensions_client->CompletePendingEmbedRequest(GURL(),
|
| + params->guest_instance_id,
|
| + browser_context(),
|
| + extension_id())) {
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +} // namespace extensions
|
|
|