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 "chrome/browser/extensions/api/guest_view/guest_view_internal_api.h" | 5 #include "chrome/browser/extensions/api/guest_view/guest_view_internal_api.h" |
6 | 6 |
7 #include "chrome/browser/guest_view/guest_view_base.h" | 7 #include "chrome/browser/guest_view/guest_view_base.h" |
8 #include "chrome/browser/guest_view/guest_view_manager.h" | 8 #include "chrome/browser/guest_view/guest_view_manager.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/extensions/api/guest_view_internal.h" | 10 #include "chrome/common/extensions/api/guest_view_internal.h" |
11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
12 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
13 #include "extensions/common/permissions/permissions_data.h" | 13 #include "extensions/common/permissions/permissions_data.h" |
14 | 14 |
| 15 namespace guest_view_internal = extensions::api::guest_view_internal; |
| 16 |
15 namespace extensions { | 17 namespace extensions { |
16 | 18 |
17 GuestViewInternalCreateGuestFunction:: | 19 GuestViewInternalCreateGuestFunction:: |
18 GuestViewInternalCreateGuestFunction() { | 20 GuestViewInternalCreateGuestFunction() { |
19 } | 21 } |
20 | 22 |
21 bool GuestViewInternalCreateGuestFunction::RunAsync() { | 23 bool GuestViewInternalCreateGuestFunction::RunAsync() { |
22 std::string view_type; | 24 std::string view_type; |
23 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &view_type)); | 25 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &view_type)); |
24 | 26 |
(...skipping 19 matching lines...) Expand all Loading... |
44 content::WebContents* guest_web_contents) { | 46 content::WebContents* guest_web_contents) { |
45 int guest_instance_id = 0; | 47 int guest_instance_id = 0; |
46 if (guest_web_contents) { | 48 if (guest_web_contents) { |
47 GuestViewBase* guest = GuestViewBase::FromWebContents(guest_web_contents); | 49 GuestViewBase* guest = GuestViewBase::FromWebContents(guest_web_contents); |
48 guest_instance_id = guest->GetGuestInstanceID(); | 50 guest_instance_id = guest->GetGuestInstanceID(); |
49 } | 51 } |
50 SetResult(new base::FundamentalValue(guest_instance_id)); | 52 SetResult(new base::FundamentalValue(guest_instance_id)); |
51 SendResponse(true); | 53 SendResponse(true); |
52 } | 54 } |
53 | 55 |
| 56 GuestViewInternalSetAutoSizeFunction:: |
| 57 GuestViewInternalSetAutoSizeFunction() { |
| 58 } |
| 59 |
| 60 GuestViewInternalSetAutoSizeFunction:: |
| 61 ~GuestViewInternalSetAutoSizeFunction() { |
| 62 } |
| 63 |
| 64 bool GuestViewInternalSetAutoSizeFunction::RunAsync() { |
| 65 scoped_ptr<guest_view_internal::SetAutoSize::Params> params( |
| 66 guest_view_internal::SetAutoSize::Params::Create(*args_)); |
| 67 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 68 GuestViewBase* guest = GuestViewBase::From( |
| 69 render_view_host()->GetProcess()->GetID(), params->instance_id); |
| 70 if (!guest) |
| 71 return false; |
| 72 guest->SetAutoSize(params->params.enable_auto_size, |
| 73 gfx::Size(params->params.min.width, |
| 74 params->params.min.height), |
| 75 gfx::Size(params->params.max.width, |
| 76 params->params.max.height)); |
| 77 SendResponse(true); |
| 78 return true; |
| 79 } |
| 80 |
54 } // namespace extensions | 81 } // namespace extensions |
OLD | NEW |