| 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" |
| 11 #include "components/crx_file/id_util.h" | 11 #include "components/crx_file/id_util.h" |
| 12 #include "components/guest_view/browser/guest_view_event.h" | 12 #include "components/guest_view/browser/guest_view_event.h" |
| 13 #include "components/guest_view/browser/guest_view_manager.h" | 13 #include "components/guest_view/browser/guest_view_manager.h" |
| 14 #include "content/public/browser/navigation_details.h" | 14 #include "content/public/browser/navigation_handle.h" |
| 15 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
| 16 #include "content/public/browser/site_instance.h" | 16 #include "content/public/browser/site_instance.h" |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/common/result_codes.h" | 18 #include "content/public/common/result_codes.h" |
| 19 #include "extensions/browser/api/extensions_api_client.h" | 19 #include "extensions/browser/api/extensions_api_client.h" |
| 20 #include "extensions/browser/bad_message.h" | 20 #include "extensions/browser/bad_message.h" |
| 21 #include "extensions/browser/extension_function_dispatcher.h" | 21 #include "extensions/browser/extension_function_dispatcher.h" |
| 22 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
| 23 #include "extensions/browser/guest_view/extension_options/extension_options_cons
tants.h" | 23 #include "extensions/browser/guest_view/extension_options/extension_options_cons
tants.h" |
| 24 #include "extensions/browser/guest_view/extension_options/extension_options_gues
t_delegate.h" | 24 #include "extensions/browser/guest_view/extension_options/extension_options_gues
t_delegate.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // ctrl-click or middle mouse button click | 213 // ctrl-click or middle mouse button click |
| 214 if (extension_options_guest_delegate_) { | 214 if (extension_options_guest_delegate_) { |
| 215 extension_options_guest_delegate_->OpenURLInNewTab( | 215 extension_options_guest_delegate_->OpenURLInNewTab( |
| 216 content::OpenURLParams(target_url, content::Referrer(), | 216 content::OpenURLParams(target_url, content::Referrer(), |
| 217 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 217 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 218 ui::PAGE_TRANSITION_LINK, false)); | 218 ui::PAGE_TRANSITION_LINK, false)); |
| 219 } | 219 } |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 | 222 |
| 223 void ExtensionOptionsGuest::DidNavigateMainFrame( | 223 void ExtensionOptionsGuest::DidFinishNavigation( |
| 224 const content::LoadCommittedDetails& details, | 224 content::NavigationHandle* navigation_handle) { |
| 225 const content::FrameNavigateParams& params) { | 225 if (!navigation_handle->IsInMainFrame() || |
| 226 if (attached()) { | 226 !navigation_handle->HasCommitted() || !attached()) { |
| 227 auto* guest_zoom_controller = | 227 return; |
| 228 zoom::ZoomController::FromWebContents(web_contents()); | 228 } |
| 229 guest_zoom_controller->SetZoomMode( | |
| 230 zoom::ZoomController::ZOOM_MODE_ISOLATED); | |
| 231 SetGuestZoomLevelToMatchEmbedder(); | |
| 232 | 229 |
| 233 if (!url::IsSameOriginWith(params.url, options_page_)) { | 230 auto* guest_zoom_controller = |
| 234 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), | 231 zoom::ZoomController::FromWebContents(web_contents()); |
| 235 bad_message::EOG_BAD_ORIGIN); | 232 guest_zoom_controller->SetZoomMode(zoom::ZoomController::ZOOM_MODE_ISOLATED); |
| 236 } | 233 SetGuestZoomLevelToMatchEmbedder(); |
| 234 |
| 235 if (!url::IsSameOriginWith(navigation_handle->GetURL(), options_page_)) { |
| 236 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), |
| 237 bad_message::EOG_BAD_ORIGIN); |
| 237 } | 238 } |
| 238 } | 239 } |
| 239 | 240 |
| 240 } // namespace extensions | 241 } // namespace extensions |
| OLD | NEW |