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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) { | 147 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) { |
148 extension_options_internal::PreferredSizeChangedOptions options; | 148 extension_options_internal::PreferredSizeChangedOptions options; |
149 // Convert the size from physical pixels to logical pixels. | 149 // Convert the size from physical pixels to logical pixels. |
150 options.width = PhysicalPixelsToLogicalPixels(pref_size.width()); | 150 options.width = PhysicalPixelsToLogicalPixels(pref_size.width()); |
151 options.height = PhysicalPixelsToLogicalPixels(pref_size.height()); | 151 options.height = PhysicalPixelsToLogicalPixels(pref_size.height()); |
152 DispatchEventToView(base::MakeUnique<GuestViewEvent>( | 152 DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
153 extension_options_internal::OnPreferredSizeChanged::kEventName, | 153 extension_options_internal::OnPreferredSizeChanged::kEventName, |
154 options.ToValue())); | 154 options.ToValue())); |
155 } | 155 } |
156 | 156 |
| 157 bool ExtensionOptionsGuest::ShouldHandleFindRequestsForEmbedder() const { |
| 158 return true; |
| 159 } |
| 160 |
157 WebContents* ExtensionOptionsGuest::OpenURLFromTab( | 161 WebContents* ExtensionOptionsGuest::OpenURLFromTab( |
158 WebContents* source, | 162 WebContents* source, |
159 const content::OpenURLParams& params) { | 163 const content::OpenURLParams& params) { |
160 if (!extension_options_guest_delegate_) | 164 if (!extension_options_guest_delegate_) |
161 return nullptr; | 165 return nullptr; |
162 | 166 |
163 // Don't allow external URLs with the CURRENT_TAB disposition be opened in | 167 // Don't allow external URLs with the CURRENT_TAB disposition be opened in |
164 // this guest view, change the disposition to NEW_FOREGROUND_TAB. | 168 // this guest view, change the disposition to NEW_FOREGROUND_TAB. |
165 if ((!params.url.SchemeIs(extensions::kExtensionScheme) || | 169 if ((!params.url.SchemeIs(extensions::kExtensionScheme) || |
166 params.url.host() != options_page_.host()) && | 170 params.url.host() != options_page_.host()) && |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 guest_zoom_controller->SetZoomMode(zoom::ZoomController::ZOOM_MODE_ISOLATED); | 232 guest_zoom_controller->SetZoomMode(zoom::ZoomController::ZOOM_MODE_ISOLATED); |
229 SetGuestZoomLevelToMatchEmbedder(); | 233 SetGuestZoomLevelToMatchEmbedder(); |
230 | 234 |
231 if (!url::IsSameOriginWith(navigation_handle->GetURL(), options_page_)) { | 235 if (!url::IsSameOriginWith(navigation_handle->GetURL(), options_page_)) { |
232 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), | 236 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), |
233 bad_message::EOG_BAD_ORIGIN); | 237 bad_message::EOG_BAD_ORIGIN); |
234 } | 238 } |
235 } | 239 } |
236 | 240 |
237 } // namespace extensions | 241 } // namespace extensions |
OLD | NEW |