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/guest_view/guest_view_internal_api.h" | 5 #include "extensions/browser/api/guest_view/guest_view_internal_api.h" |
6 | 6 |
7 #include "content/public/browser/render_process_host.h" | 7 #include "content/public/browser/render_process_host.h" |
8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
9 #include "extensions/browser/guest_view/guest_view_base.h" | 9 #include "extensions/browser/guest_view/guest_view_base.h" |
10 #include "extensions/browser/guest_view/guest_view_manager.h" | 10 #include "extensions/browser/guest_view/guest_view_manager.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 GuestViewManager::WebContentsCreatedCallback callback = | 32 GuestViewManager::WebContentsCreatedCallback callback = |
33 base::Bind(&GuestViewInternalCreateGuestFunction::CreateGuestCallback, | 33 base::Bind(&GuestViewInternalCreateGuestFunction::CreateGuestCallback, |
34 this); | 34 this); |
35 | 35 |
36 content::WebContents* sender_web_contents = GetSenderWebContents(); | 36 content::WebContents* sender_web_contents = GetSenderWebContents(); |
37 if (!sender_web_contents) { | 37 if (!sender_web_contents) { |
38 error_ = "Guest views can only be embedded in web content"; | 38 error_ = "Guest views can only be embedded in web content"; |
39 return false; | 39 return false; |
40 } | 40 } |
41 | 41 |
| 42 // Add flag to |create_params| to indicate that the element size is specified |
| 43 // in logical units. |
| 44 create_params->SetBoolean(guestview::kElementSizeIsLogical, true); |
| 45 |
42 guest_view_manager->CreateGuest(view_type, | 46 guest_view_manager->CreateGuest(view_type, |
43 sender_web_contents, | 47 sender_web_contents, |
44 *create_params, | 48 *create_params, |
45 callback); | 49 callback); |
46 return true; | 50 return true; |
47 } | 51 } |
48 | 52 |
49 void GuestViewInternalCreateGuestFunction::CreateGuestCallback( | 53 void GuestViewInternalCreateGuestFunction::CreateGuestCallback( |
50 content::WebContents* guest_web_contents) { | 54 content::WebContents* guest_web_contents) { |
51 int guest_instance_id = 0; | 55 int guest_instance_id = 0; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 set_size_params.normal_size.reset(new gfx::Size( | 114 set_size_params.normal_size.reset(new gfx::Size( |
111 params->params.normal->width, params->params.normal->height)); | 115 params->params.normal->width, params->params.normal->height)); |
112 } | 116 } |
113 | 117 |
114 guest->SetSize(set_size_params); | 118 guest->SetSize(set_size_params); |
115 SendResponse(true); | 119 SendResponse(true); |
116 return true; | 120 return true; |
117 } | 121 } |
118 | 122 |
119 } // namespace extensions | 123 } // namespace extensions |
OLD | NEW |