OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "extensions/browser/api/app_view/app_view_internal_api.h" | |
6 | |
7 #include "extensions/browser/api/extensions_api_client.h" | |
8 #include "extensions/common/api/app_view_internal.h" | |
9 | |
10 | |
11 namespace extensions { | |
12 | |
13 namespace appview = core_api::app_view_internal; | |
14 | |
15 AppViewInternalAttachFrameFunction:: | |
16 AppViewInternalAttachFrameFunction() { | |
17 } | |
18 | |
19 bool AppViewInternalAttachFrameFunction::RunAsync() { | |
20 scoped_ptr<appview::AttachFrame::Params> params( | |
21 appview::AttachFrame::Params::Create(*args_)); | |
22 EXTENSION_FUNCTION_VALIDATE(params.get()); | |
23 | |
24 GURL url = GetExtension()->GetResourceURL(params->url); | |
25 EXTENSION_FUNCTION_VALIDATE(url.is_valid()); | |
26 | |
27 extensions::ExtensionsAPIClient* extensions_client = | |
James Cook
2014/07/11 03:16:01
extensions:: not needed
Fady Samuel
2014/07/11 15:28:55
Done.
| |
28 extensions::ExtensionsAPIClient::Get(); | |
29 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.
| |
30 params->guest_instance_id, | |
31 browser_context(), | |
32 extension_id())) { | |
33 return false; | |
34 } | |
35 | |
36 return true; | |
37 } | |
38 | |
39 AppViewInternalDenyRequestFunction:: | |
40 AppViewInternalDenyRequestFunction() { | |
41 } | |
42 | |
43 bool AppViewInternalDenyRequestFunction::RunAsync() { | |
44 scoped_ptr<appview::DenyRequest::Params> params( | |
45 appview::DenyRequest::Params::Create(*args_)); | |
46 EXTENSION_FUNCTION_VALIDATE(params.get()); | |
47 | |
48 extensions::ExtensionsAPIClient* extensions_client = | |
James Cook
2014/07/11 03:16:01
ditto extensions::
Fady Samuel
2014/07/11 15:28:55
Done.
| |
49 extensions::ExtensionsAPIClient::Get(); | |
50 // Since the URL passed into AppViewGuest:::CompletePendingRequest is invalid, | |
51 // a new <appview> WebContents will not be created. | |
52 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.
| |
53 browser_context(), | |
54 extension_id())) { | |
55 return false; | |
56 } | |
57 return true; | |
58 } | |
59 | |
60 } // namespace extensions | |
OLD | NEW |