Chromium Code Reviews| 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() || !navigation_handle->HasCommitted()) |
| 226 return; | |
| 227 | |
| 226 if (attached()) { | 228 if (attached()) { |
|
Devlin
2017/02/01 16:11:06
nit: maybe combine this with the if above?
if (!na
jam
2017/02/01 16:22:09
Done.
| |
| 227 auto* guest_zoom_controller = | 229 auto* guest_zoom_controller = |
| 228 zoom::ZoomController::FromWebContents(web_contents()); | 230 zoom::ZoomController::FromWebContents(web_contents()); |
| 229 guest_zoom_controller->SetZoomMode( | 231 guest_zoom_controller->SetZoomMode( |
| 230 zoom::ZoomController::ZOOM_MODE_ISOLATED); | 232 zoom::ZoomController::ZOOM_MODE_ISOLATED); |
| 231 SetGuestZoomLevelToMatchEmbedder(); | 233 SetGuestZoomLevelToMatchEmbedder(); |
| 232 | 234 |
| 233 if (!url::IsSameOriginWith(params.url, options_page_)) { | 235 if (!url::IsSameOriginWith(navigation_handle->GetURL(), options_page_)) { |
| 234 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), | 236 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), |
| 235 bad_message::EOG_BAD_ORIGIN); | 237 bad_message::EOG_BAD_ORIGIN); |
| 236 } | 238 } |
| 237 } | 239 } |
| 238 } | 240 } |
| 239 | 241 |
| 240 } // namespace extensions | 242 } // namespace extensions |
| OLD | NEW |