Chromium Code Reviews| 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..b3a43dbfedc5e04e4c5c2ad502cb5d5e9293576b |
| --- /dev/null |
| +++ b/extensions/browser/api/app_view/app_view_internal_api.cc |
| @@ -0,0 +1,60 @@ |
| +// 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/api/extensions_api_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::ExtensionsAPIClient* extensions_client = |
|
James Cook
2014/07/11 03:16:01
extensions:: not needed
Fady Samuel
2014/07/11 15:28:55
Done.
|
| + extensions::ExtensionsAPIClient::Get(); |
| + if (!extensions_client->AppViewInternalAttachFrame(url, |
|
James Cook
2014/07/11 03:16:01
You could just "return extensions_client->..." ins
Fady Samuel
2014/07/11 15:28:55
Done.
|
| + 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::ExtensionsAPIClient* extensions_client = |
|
James Cook
2014/07/11 03:16:01
ditto extensions::
Fady Samuel
2014/07/11 15:28:55
Done.
|
| + extensions::ExtensionsAPIClient::Get(); |
| + // Since the URL passed into AppViewGuest:::CompletePendingRequest is invalid, |
| + // a new <appview> WebContents will not be created. |
| + if (!extensions_client->AppViewInternalDenyRequest(params->guest_instance_id, |
|
James Cook
2014/07/11 03:16:01
ditto if()
Fady Samuel
2014/07/11 15:28:55
Done.
|
| + browser_context(), |
| + extension_id())) { |
| + return false; |
| + } |
| + return true; |
| +} |
| + |
| +} // namespace extensions |