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/guest_view/extension_options/extension_options_gues
t.h" | 5 #include "extensions/browser/guest_view/extension_options/extension_options_gues
t.h" |
6 | 6 |
7 #include "base/metrics/user_metrics.h" | 7 #include "base/metrics/user_metrics.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "components/crx_file/id_util.h" | 9 #include "components/crx_file/id_util.h" |
10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { | 155 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const { | 159 bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const { |
160 return true; | 160 return true; |
161 } | 161 } |
162 | 162 |
163 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) { | 163 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) { |
164 extension_options_internal::PreferredSizeChangedOptions options; | 164 extension_options_internal::PreferredSizeChangedOptions options; |
165 options.width = pref_size.width(); | 165 // Convert the size from physical pixels to logical pixels. |
166 options.height = pref_size.height(); | 166 options.width = PhysicalPixelsToLogicalPixels(pref_size.width()); |
| 167 options.height = PhysicalPixelsToLogicalPixels(pref_size.height()); |
167 DispatchEventToView(new GuestViewBase::Event( | 168 DispatchEventToView(new GuestViewBase::Event( |
168 extension_options_internal::OnPreferredSizeChanged::kEventName, | 169 extension_options_internal::OnPreferredSizeChanged::kEventName, |
169 options.ToValue())); | 170 options.ToValue())); |
170 } | 171 } |
171 | 172 |
172 content::WebContents* ExtensionOptionsGuest::GetAssociatedWebContents() const { | 173 content::WebContents* ExtensionOptionsGuest::GetAssociatedWebContents() const { |
173 return web_contents(); | 174 return web_contents(); |
174 } | 175 } |
175 | 176 |
176 content::WebContents* ExtensionOptionsGuest::OpenURLFromTab( | 177 content::WebContents* ExtensionOptionsGuest::OpenURLFromTab( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 return handled; | 256 return handled; |
256 } | 257 } |
257 | 258 |
258 void ExtensionOptionsGuest::OnRequest( | 259 void ExtensionOptionsGuest::OnRequest( |
259 const ExtensionHostMsg_Request_Params& params) { | 260 const ExtensionHostMsg_Request_Params& params) { |
260 extension_function_dispatcher_->Dispatch(params, | 261 extension_function_dispatcher_->Dispatch(params, |
261 web_contents()->GetRenderViewHost()); | 262 web_contents()->GetRenderViewHost()); |
262 } | 263 } |
263 | 264 |
264 } // namespace extensions | 265 } // namespace extensions |
OLD | NEW |