| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "extensions/browser/api/app_view/app_view_internal_api.h" | 5 #include "extensions/browser/api/app_view/app_view_internal_api.h" |
| 6 | 6 |
| 7 #include "extensions/browser/api/extensions_api_client.h" | 7 #include "extensions/browser/guest_view/app_view/app_view_guest.h" |
| 8 #include "extensions/common/api/app_view_internal.h" | 8 #include "extensions/common/api/app_view_internal.h" |
| 9 | 9 |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 namespace appview = core_api::app_view_internal; | 13 namespace appview = core_api::app_view_internal; |
| 14 | 14 |
| 15 AppViewInternalAttachFrameFunction:: | 15 AppViewInternalAttachFrameFunction:: |
| 16 AppViewInternalAttachFrameFunction() { | 16 AppViewInternalAttachFrameFunction() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 bool AppViewInternalAttachFrameFunction::RunAsync() { | 19 bool AppViewInternalAttachFrameFunction::RunAsync() { |
| 20 scoped_ptr<appview::AttachFrame::Params> params( | 20 scoped_ptr<appview::AttachFrame::Params> params( |
| 21 appview::AttachFrame::Params::Create(*args_)); | 21 appview::AttachFrame::Params::Create(*args_)); |
| 22 EXTENSION_FUNCTION_VALIDATE(params.get()); | 22 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 23 | 23 |
| 24 GURL url = extension()->GetResourceURL(params->url); | 24 GURL url = extension()->GetResourceURL(params->url); |
| 25 EXTENSION_FUNCTION_VALIDATE(url.is_valid()); | 25 EXTENSION_FUNCTION_VALIDATE(url.is_valid()); |
| 26 | 26 |
| 27 ExtensionsAPIClient* extensions_client = ExtensionsAPIClient::Get(); | 27 return AppViewGuest::CompletePendingRequest(browser_context(), |
| 28 return extensions_client->AppViewInternalAttachFrame( | 28 url, |
| 29 browser_context(), | 29 params->guest_instance_id, |
| 30 url, | 30 extension_id()); |
| 31 params->guest_instance_id, | |
| 32 extension_id()); | |
| 33 } | 31 } |
| 34 | 32 |
| 35 AppViewInternalDenyRequestFunction:: | 33 AppViewInternalDenyRequestFunction:: |
| 36 AppViewInternalDenyRequestFunction() { | 34 AppViewInternalDenyRequestFunction() { |
| 37 } | 35 } |
| 38 | 36 |
| 39 bool AppViewInternalDenyRequestFunction::RunAsync() { | 37 bool AppViewInternalDenyRequestFunction::RunAsync() { |
| 40 scoped_ptr<appview::DenyRequest::Params> params( | 38 scoped_ptr<appview::DenyRequest::Params> params( |
| 41 appview::DenyRequest::Params::Create(*args_)); | 39 appview::DenyRequest::Params::Create(*args_)); |
| 42 EXTENSION_FUNCTION_VALIDATE(params.get()); | 40 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 43 | 41 |
| 44 ExtensionsAPIClient* extensions_client = ExtensionsAPIClient::Get(); | |
| 45 // Since the URL passed into AppViewGuest:::CompletePendingRequest is invalid, | 42 // Since the URL passed into AppViewGuest:::CompletePendingRequest is invalid, |
| 46 // a new <appview> WebContents will not be created. | 43 // a new <appview> WebContents will not be created. |
| 47 return extensions_client->AppViewInternalDenyRequest( | 44 return AppViewGuest::CompletePendingRequest(browser_context(), |
| 48 browser_context(), | 45 GURL(), |
| 49 params->guest_instance_id, | 46 params->guest_instance_id, |
| 50 extension_id()); | 47 extension_id()); |
| 51 } | 48 } |
| 52 | 49 |
| 53 } // namespace extensions | 50 } // namespace extensions |
| OLD | NEW |