| 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 | |
| 161 WebContents* ExtensionOptionsGuest::OpenURLFromTab( | 157 WebContents* ExtensionOptionsGuest::OpenURLFromTab( |
| 162 WebContents* source, | 158 WebContents* source, |
| 163 const content::OpenURLParams& params) { | 159 const content::OpenURLParams& params) { |
| 164 if (!extension_options_guest_delegate_) | 160 if (!extension_options_guest_delegate_) |
| 165 return nullptr; | 161 return nullptr; |
| 166 | 162 |
| 167 // Don't allow external URLs with the CURRENT_TAB disposition be opened in | 163 // Don't allow external URLs with the CURRENT_TAB disposition be opened in |
| 168 // this guest view, change the disposition to NEW_FOREGROUND_TAB. | 164 // this guest view, change the disposition to NEW_FOREGROUND_TAB. |
| 169 if ((!params.url.SchemeIs(extensions::kExtensionScheme) || | 165 if ((!params.url.SchemeIs(extensions::kExtensionScheme) || |
| 170 params.url.host() != options_page_.host()) && | 166 params.url.host() != options_page_.host()) && |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 guest_zoom_controller->SetZoomMode(zoom::ZoomController::ZOOM_MODE_ISOLATED); | 228 guest_zoom_controller->SetZoomMode(zoom::ZoomController::ZOOM_MODE_ISOLATED); |
| 233 SetGuestZoomLevelToMatchEmbedder(); | 229 SetGuestZoomLevelToMatchEmbedder(); |
| 234 | 230 |
| 235 if (!url::IsSameOriginWith(navigation_handle->GetURL(), options_page_)) { | 231 if (!url::IsSameOriginWith(navigation_handle->GetURL(), options_page_)) { |
| 236 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), | 232 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), |
| 237 bad_message::EOG_BAD_ORIGIN); | 233 bad_message::EOG_BAD_ORIGIN); |
| 238 } | 234 } |
| 239 } | 235 } |
| 240 | 236 |
| 241 } // namespace extensions | 237 } // namespace extensions |
| OLD | NEW |