| 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/web_view/web_view_guest.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" | 10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // Clean up content scripts for the WebView. | 229 // Clean up content scripts for the WebView. |
| 230 auto csm = WebViewContentScriptManager::Get(browser_context); | 230 auto csm = WebViewContentScriptManager::Get(browser_context); |
| 231 csm->RemoveAllContentScriptsForWebView(embedder_process_id, view_instance_id); | 231 csm->RemoveAllContentScriptsForWebView(embedder_process_id, view_instance_id); |
| 232 | 232 |
| 233 // Allow an extensions browser client to potentially perform more cleanup. | 233 // Allow an extensions browser client to potentially perform more cleanup. |
| 234 ExtensionsBrowserClient::Get()->CleanUpWebView( | 234 ExtensionsBrowserClient::Get()->CleanUpWebView( |
| 235 browser_context, embedder_process_id, view_instance_id); | 235 browser_context, embedder_process_id, view_instance_id); |
| 236 } | 236 } |
| 237 | 237 |
| 238 // static | 238 // static |
| 239 GuestViewBase* WebViewGuest::Create(content::WebContents* owner_web_contents) { | 239 GuestViewBase* WebViewGuest::Create(WebContents* owner_web_contents) { |
| 240 return new WebViewGuest(owner_web_contents); | 240 return new WebViewGuest(owner_web_contents); |
| 241 } | 241 } |
| 242 | 242 |
| 243 // static | 243 // static |
| 244 bool WebViewGuest::GetGuestPartitionConfigForSite( | 244 bool WebViewGuest::GetGuestPartitionConfigForSite( |
| 245 const GURL& site, | 245 const GURL& site, |
| 246 std::string* partition_domain, | 246 std::string* partition_domain, |
| 247 std::string* partition_name, | 247 std::string* partition_name, |
| 248 bool* in_memory) { | 248 bool* in_memory) { |
| 249 if (!site.SchemeIs(content::kGuestScheme)) | 249 if (!site.SchemeIs(content::kGuestScheme)) |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 | 533 |
| 534 void WebViewGuest::HandleKeyboardEvent( | 534 void WebViewGuest::HandleKeyboardEvent( |
| 535 WebContents* source, | 535 WebContents* source, |
| 536 const content::NativeWebKeyboardEvent& event) { | 536 const content::NativeWebKeyboardEvent& event) { |
| 537 if (HandleKeyboardShortcuts(event)) | 537 if (HandleKeyboardShortcuts(event)) |
| 538 return; | 538 return; |
| 539 | 539 |
| 540 GuestViewBase::HandleKeyboardEvent(source, event); | 540 GuestViewBase::HandleKeyboardEvent(source, event); |
| 541 } | 541 } |
| 542 | 542 |
| 543 bool WebViewGuest::PreHandleGestureEvent(content::WebContents* source, | 543 bool WebViewGuest::PreHandleGestureEvent(WebContents* source, |
| 544 const blink::WebGestureEvent& event) { | 544 const blink::WebGestureEvent& event) { |
| 545 return !allow_scaling_ && GuestViewBase::PreHandleGestureEvent(source, event); | 545 return !allow_scaling_ && GuestViewBase::PreHandleGestureEvent(source, event); |
| 546 } | 546 } |
| 547 | 547 |
| 548 void WebViewGuest::LoadProgressChanged(content::WebContents* source, | 548 void WebViewGuest::LoadProgressChanged(WebContents* source, double progress) { |
| 549 double progress) { | |
| 550 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 549 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 551 args->SetString(guest_view::kUrl, web_contents()->GetURL().spec()); | 550 args->SetString(guest_view::kUrl, web_contents()->GetURL().spec()); |
| 552 args->SetDouble(webview::kProgress, progress); | 551 args->SetDouble(webview::kProgress, progress); |
| 553 DispatchEventToView( | 552 DispatchEventToView( |
| 554 new GuestViewEvent(webview::kEventLoadProgress, args.Pass())); | 553 new GuestViewEvent(webview::kEventLoadProgress, args.Pass())); |
| 555 } | 554 } |
| 556 | 555 |
| 557 void WebViewGuest::LoadAbort(bool is_top_level, | 556 void WebViewGuest::LoadAbort(bool is_top_level, |
| 558 const GURL& url, | 557 const GURL& url, |
| 559 int error_code, | 558 int error_code, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 581 create_params.SetString(webview::kStoragePartitionId, storage_partition_id); | 580 create_params.SetString(webview::kStoragePartitionId, storage_partition_id); |
| 582 | 581 |
| 583 guest_manager->CreateGuest(WebViewGuest::Type, | 582 guest_manager->CreateGuest(WebViewGuest::Type, |
| 584 embedder_web_contents(), | 583 embedder_web_contents(), |
| 585 create_params, | 584 create_params, |
| 586 base::Bind(&WebViewGuest::NewGuestWebViewCallback, | 585 base::Bind(&WebViewGuest::NewGuestWebViewCallback, |
| 587 weak_ptr_factory_.GetWeakPtr(), | 586 weak_ptr_factory_.GetWeakPtr(), |
| 588 params)); | 587 params)); |
| 589 } | 588 } |
| 590 | 589 |
| 591 void WebViewGuest::NewGuestWebViewCallback( | 590 void WebViewGuest::NewGuestWebViewCallback(const content::OpenURLParams& params, |
| 592 const content::OpenURLParams& params, | 591 WebContents* guest_web_contents) { |
| 593 content::WebContents* guest_web_contents) { | |
| 594 WebViewGuest* new_guest = WebViewGuest::FromWebContents(guest_web_contents); | 592 WebViewGuest* new_guest = WebViewGuest::FromWebContents(guest_web_contents); |
| 595 new_guest->SetOpener(this); | 593 new_guest->SetOpener(this); |
| 596 | 594 |
| 597 // Take ownership of |new_guest|. | 595 // Take ownership of |new_guest|. |
| 598 pending_new_windows_.insert( | 596 pending_new_windows_.insert( |
| 599 std::make_pair(new_guest, NewWindowInfo(params.url, std::string()))); | 597 std::make_pair(new_guest, NewWindowInfo(params.url, std::string()))); |
| 600 | 598 |
| 601 // Request permission to show the new window. | 599 // Request permission to show the new window. |
| 602 RequestNewWindowPermission(params.disposition, | 600 RequestNewWindowPermission(params.disposition, |
| 603 gfx::Rect(), | 601 gfx::Rect(), |
| 604 params.user_gesture, | 602 params.user_gesture, |
| 605 new_guest->web_contents()); | 603 new_guest->web_contents()); |
| 606 } | 604 } |
| 607 | 605 |
| 608 // TODO(fsamuel): Find a reliable way to test the 'responsive' and | 606 // TODO(fsamuel): Find a reliable way to test the 'responsive' and |
| 609 // 'unresponsive' events. | 607 // 'unresponsive' events. |
| 610 void WebViewGuest::RendererResponsive(content::WebContents* source) { | 608 void WebViewGuest::RendererResponsive(WebContents* source) { |
| 611 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 609 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 612 args->SetInteger(webview::kProcessId, | 610 args->SetInteger(webview::kProcessId, |
| 613 web_contents()->GetRenderProcessHost()->GetID()); | 611 web_contents()->GetRenderProcessHost()->GetID()); |
| 614 DispatchEventToView( | 612 DispatchEventToView( |
| 615 new GuestViewEvent(webview::kEventResponsive, args.Pass())); | 613 new GuestViewEvent(webview::kEventResponsive, args.Pass())); |
| 616 } | 614 } |
| 617 | 615 |
| 618 void WebViewGuest::RendererUnresponsive(content::WebContents* source) { | 616 void WebViewGuest::RendererUnresponsive(WebContents* source) { |
| 619 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 617 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 620 args->SetInteger(webview::kProcessId, | 618 args->SetInteger(webview::kProcessId, |
| 621 web_contents()->GetRenderProcessHost()->GetID()); | 619 web_contents()->GetRenderProcessHost()->GetID()); |
| 622 DispatchEventToView( | 620 DispatchEventToView( |
| 623 new GuestViewEvent(webview::kEventUnresponsive, args.Pass())); | 621 new GuestViewEvent(webview::kEventUnresponsive, args.Pass())); |
| 624 } | 622 } |
| 625 | 623 |
| 626 void WebViewGuest::Observe(int type, | 624 void WebViewGuest::Observe(int type, |
| 627 const content::NotificationSource& source, | 625 const content::NotificationSource& source, |
| 628 const content::NotificationDetails& details) { | 626 const content::NotificationDetails& details) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 partition, remove_since, base::Time::Now()) | 729 partition, remove_since, base::Time::Now()) |
| 732 ->Remove(cache_removal_done_callback); | 730 ->Remove(cache_removal_done_callback); |
| 733 | 731 |
| 734 return true; | 732 return true; |
| 735 } | 733 } |
| 736 | 734 |
| 737 ClearDataInternal(remove_since, removal_mask, callback); | 735 ClearDataInternal(remove_since, removal_mask, callback); |
| 738 return true; | 736 return true; |
| 739 } | 737 } |
| 740 | 738 |
| 741 WebViewGuest::WebViewGuest(content::WebContents* owner_web_contents) | 739 WebViewGuest::WebViewGuest(WebContents* owner_web_contents) |
| 742 : GuestView<WebViewGuest>(owner_web_contents), | 740 : GuestView<WebViewGuest>(owner_web_contents), |
| 743 rules_registry_id_(RulesRegistryService::kInvalidRulesRegistryID), | 741 rules_registry_id_(RulesRegistryService::kInvalidRulesRegistryID), |
| 744 find_helper_(this), | 742 find_helper_(this), |
| 745 is_overriding_user_agent_(false), | 743 is_overriding_user_agent_(false), |
| 746 allow_transparency_(false), | 744 allow_transparency_(false), |
| 747 javascript_dialog_helper_(this), | 745 javascript_dialog_helper_(this), |
| 748 allow_scaling_(false), | 746 allow_scaling_(false), |
| 749 is_guest_fullscreen_(false), | 747 is_guest_fullscreen_(false), |
| 750 is_embedder_fullscreen_(false), | 748 is_embedder_fullscreen_(false), |
| 751 last_fullscreen_permission_was_allowed_by_embedder_(false), | 749 last_fullscreen_permission_was_allowed_by_embedder_(false), |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 content::BrowserThread::PostTask( | 914 content::BrowserThread::PostTask( |
| 917 content::BrowserThread::IO, FROM_HERE, | 915 content::BrowserThread::IO, FROM_HERE, |
| 918 base::Bind( | 916 base::Bind( |
| 919 &WebViewRendererState::RemoveGuest, | 917 &WebViewRendererState::RemoveGuest, |
| 920 base::Unretained(WebViewRendererState::GetInstance()), | 918 base::Unretained(WebViewRendererState::GetInstance()), |
| 921 web_contents->GetRenderProcessHost()->GetID(), | 919 web_contents->GetRenderProcessHost()->GetID(), |
| 922 web_contents->GetRoutingID())); | 920 web_contents->GetRoutingID())); |
| 923 } | 921 } |
| 924 | 922 |
| 925 void WebViewGuest::RequestMediaAccessPermission( | 923 void WebViewGuest::RequestMediaAccessPermission( |
| 926 content::WebContents* source, | 924 WebContents* source, |
| 927 const content::MediaStreamRequest& request, | 925 const content::MediaStreamRequest& request, |
| 928 const content::MediaResponseCallback& callback) { | 926 const content::MediaResponseCallback& callback) { |
| 929 web_view_permission_helper_->RequestMediaAccessPermission(source, | 927 web_view_permission_helper_->RequestMediaAccessPermission(source, |
| 930 request, | 928 request, |
| 931 callback); | 929 callback); |
| 932 } | 930 } |
| 933 | 931 |
| 934 bool WebViewGuest::CheckMediaAccessPermission(content::WebContents* source, | 932 bool WebViewGuest::CheckMediaAccessPermission(WebContents* source, |
| 935 const GURL& security_origin, | 933 const GURL& security_origin, |
| 936 content::MediaStreamType type) { | 934 content::MediaStreamType type) { |
| 937 return web_view_permission_helper_->CheckMediaAccessPermission( | 935 return web_view_permission_helper_->CheckMediaAccessPermission( |
| 938 source, security_origin, type); | 936 source, security_origin, type); |
| 939 } | 937 } |
| 940 | 938 |
| 941 void WebViewGuest::CanDownload( | 939 void WebViewGuest::CanDownload( |
| 942 const GURL& url, | 940 const GURL& url, |
| 943 const std::string& request_method, | 941 const std::string& request_method, |
| 944 const base::Callback<void(bool)>& callback) { | 942 const base::Callback<void(bool)>& callback) { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 load_params.virtual_url_for_data_url = virtual_gurl; | 1189 load_params.virtual_url_for_data_url = virtual_gurl; |
| 1192 load_params.override_user_agent = | 1190 load_params.override_user_agent = |
| 1193 content::NavigationController::UA_OVERRIDE_INHERIT; | 1191 content::NavigationController::UA_OVERRIDE_INHERIT; |
| 1194 | 1192 |
| 1195 // Navigate to the data URL. | 1193 // Navigate to the data URL. |
| 1196 GuestViewBase::LoadURLWithParams(load_params); | 1194 GuestViewBase::LoadURLWithParams(load_params); |
| 1197 | 1195 |
| 1198 return true; | 1196 return true; |
| 1199 } | 1197 } |
| 1200 | 1198 |
| 1201 void WebViewGuest::AddNewContents(content::WebContents* source, | 1199 void WebViewGuest::AddNewContents(WebContents* source, |
| 1202 content::WebContents* new_contents, | 1200 WebContents* new_contents, |
| 1203 WindowOpenDisposition disposition, | 1201 WindowOpenDisposition disposition, |
| 1204 const gfx::Rect& initial_rect, | 1202 const gfx::Rect& initial_rect, |
| 1205 bool user_gesture, | 1203 bool user_gesture, |
| 1206 bool* was_blocked) { | 1204 bool* was_blocked) { |
| 1207 if (was_blocked) | 1205 if (was_blocked) |
| 1208 *was_blocked = false; | 1206 *was_blocked = false; |
| 1209 RequestNewWindowPermission(disposition, | 1207 RequestNewWindowPermission(disposition, |
| 1210 initial_rect, | 1208 initial_rect, |
| 1211 user_gesture, | 1209 user_gesture, |
| 1212 new_contents); | 1210 new_contents); |
| 1213 } | 1211 } |
| 1214 | 1212 |
| 1215 content::WebContents* WebViewGuest::OpenURLFromTab( | 1213 WebContents* WebViewGuest::OpenURLFromTab( |
| 1216 content::WebContents* source, | 1214 WebContents* source, |
| 1217 const content::OpenURLParams& params) { | 1215 const content::OpenURLParams& params) { |
| 1218 // Most navigations should be handled by WebViewGuest::LoadURLWithParams, | 1216 // Most navigations should be handled by WebViewGuest::LoadURLWithParams, |
| 1219 // which takes care of blocking chrome:// URLs and other web-unsafe schemes. | 1217 // which takes care of blocking chrome:// URLs and other web-unsafe schemes. |
| 1220 // (NavigateGuest and CreateNewGuestWebViewWindow also go through | 1218 // (NavigateGuest and CreateNewGuestWebViewWindow also go through |
| 1221 // LoadURLWithParams.) | 1219 // LoadURLWithParams.) |
| 1222 // | 1220 // |
| 1223 // We make an exception here for context menu items, since the Language | 1221 // We make an exception here for context menu items, since the Language |
| 1224 // Settings item uses a browser-initiated navigation to a chrome:// URL. | 1222 // Settings item uses a browser-initiated navigation to a chrome:// URL. |
| 1225 // These can be passed to the embedder's WebContentsDelegate so that the | 1223 // These can be passed to the embedder's WebContentsDelegate so that the |
| 1226 // browser performs the action for the <webview>. | 1224 // browser performs the action for the <webview>. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 // keyboard/mouse combinations are used to open a link in a new tab/window. | 1271 // keyboard/mouse combinations are used to open a link in a new tab/window. |
| 1274 // This code path is also taken on client-side redirects from about:blank. | 1272 // This code path is also taken on client-side redirects from about:blank. |
| 1275 CreateNewGuestWebViewWindow(params); | 1273 CreateNewGuestWebViewWindow(params); |
| 1276 return nullptr; | 1274 return nullptr; |
| 1277 } | 1275 } |
| 1278 | 1276 |
| 1279 void WebViewGuest::WebContentsCreated(WebContents* source_contents, | 1277 void WebViewGuest::WebContentsCreated(WebContents* source_contents, |
| 1280 int opener_render_frame_id, | 1278 int opener_render_frame_id, |
| 1281 const std::string& frame_name, | 1279 const std::string& frame_name, |
| 1282 const GURL& target_url, | 1280 const GURL& target_url, |
| 1283 content::WebContents* new_contents) { | 1281 WebContents* new_contents) { |
| 1284 auto guest = WebViewGuest::FromWebContents(new_contents); | 1282 auto guest = WebViewGuest::FromWebContents(new_contents); |
| 1285 CHECK(guest); | 1283 CHECK(guest); |
| 1286 guest->SetOpener(this); | 1284 guest->SetOpener(this); |
| 1287 guest->name_ = frame_name; | 1285 guest->name_ = frame_name; |
| 1288 pending_new_windows_.insert( | 1286 pending_new_windows_.insert( |
| 1289 std::make_pair(guest, NewWindowInfo(target_url, frame_name))); | 1287 std::make_pair(guest, NewWindowInfo(target_url, frame_name))); |
| 1290 } | 1288 } |
| 1291 | 1289 |
| 1292 void WebViewGuest::EnterFullscreenModeForTab(content::WebContents* web_contents, | 1290 void WebViewGuest::EnterFullscreenModeForTab(WebContents* web_contents, |
| 1293 const GURL& origin) { | 1291 const GURL& origin) { |
| 1294 // Ask the embedder for permission. | 1292 // Ask the embedder for permission. |
| 1295 base::DictionaryValue request_info; | 1293 base::DictionaryValue request_info; |
| 1296 request_info.SetString(webview::kOrigin, origin.spec()); | 1294 request_info.SetString(webview::kOrigin, origin.spec()); |
| 1297 web_view_permission_helper_->RequestPermission( | 1295 web_view_permission_helper_->RequestPermission( |
| 1298 WEB_VIEW_PERMISSION_TYPE_FULLSCREEN, request_info, | 1296 WEB_VIEW_PERMISSION_TYPE_FULLSCREEN, request_info, |
| 1299 base::Bind(&WebViewGuest::OnFullscreenPermissionDecided, | 1297 base::Bind(&WebViewGuest::OnFullscreenPermissionDecided, |
| 1300 weak_ptr_factory_.GetWeakPtr()), | 1298 weak_ptr_factory_.GetWeakPtr()), |
| 1301 false /* allowed_by_default */); | 1299 false /* allowed_by_default */); |
| 1302 | 1300 |
| 1303 // TODO(lazyboy): Right now the guest immediately goes fullscreen within its | 1301 // TODO(lazyboy): Right now the guest immediately goes fullscreen within its |
| 1304 // bounds. If the embedder denies the permission then we will see a flicker. | 1302 // bounds. If the embedder denies the permission then we will see a flicker. |
| 1305 // Once we have the ability to "cancel" a renderer/ fullscreen request: | 1303 // Once we have the ability to "cancel" a renderer/ fullscreen request: |
| 1306 // http://crbug.com/466854 this won't be necessary and we should be | 1304 // http://crbug.com/466854 this won't be necessary and we should be |
| 1307 // Calling SetFullscreenState(true) once the embedder allowed the request. | 1305 // Calling SetFullscreenState(true) once the embedder allowed the request. |
| 1308 // Otherwise we would cancel renderer/ fullscreen if the embedder denied. | 1306 // Otherwise we would cancel renderer/ fullscreen if the embedder denied. |
| 1309 SetFullscreenState(true); | 1307 SetFullscreenState(true); |
| 1310 } | 1308 } |
| 1311 | 1309 |
| 1312 void WebViewGuest::ExitFullscreenModeForTab( | 1310 void WebViewGuest::ExitFullscreenModeForTab(WebContents* web_contents) { |
| 1313 content::WebContents* web_contents) { | |
| 1314 SetFullscreenState(false); | 1311 SetFullscreenState(false); |
| 1315 } | 1312 } |
| 1316 | 1313 |
| 1317 bool WebViewGuest::IsFullscreenForTabOrPending( | 1314 bool WebViewGuest::IsFullscreenForTabOrPending( |
| 1318 const content::WebContents* web_contents) const { | 1315 const WebContents* web_contents) const { |
| 1319 return is_guest_fullscreen_; | 1316 return is_guest_fullscreen_; |
| 1320 } | 1317 } |
| 1321 | 1318 |
| 1322 void WebViewGuest::LoadURLWithParams( | 1319 void WebViewGuest::LoadURLWithParams( |
| 1323 const GURL& url, | 1320 const GURL& url, |
| 1324 const content::Referrer& referrer, | 1321 const content::Referrer& referrer, |
| 1325 ui::PageTransition transition_type, | 1322 ui::PageTransition transition_type, |
| 1326 const GlobalRequestID& transferred_global_request_id, | 1323 const GlobalRequestID& transferred_global_request_id, |
| 1327 bool force_navigation) { | 1324 bool force_navigation) { |
| 1328 if (!url.is_valid()) { | 1325 if (!url.is_valid()) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 load_url_params.transferred_global_request_id = transferred_global_request_id; | 1361 load_url_params.transferred_global_request_id = transferred_global_request_id; |
| 1365 if (is_overriding_user_agent_) { | 1362 if (is_overriding_user_agent_) { |
| 1366 load_url_params.override_user_agent = | 1363 load_url_params.override_user_agent = |
| 1367 content::NavigationController::UA_OVERRIDE_TRUE; | 1364 content::NavigationController::UA_OVERRIDE_TRUE; |
| 1368 } | 1365 } |
| 1369 GuestViewBase::LoadURLWithParams(load_url_params); | 1366 GuestViewBase::LoadURLWithParams(load_url_params); |
| 1370 | 1367 |
| 1371 src_ = validated_url; | 1368 src_ = validated_url; |
| 1372 } | 1369 } |
| 1373 | 1370 |
| 1374 void WebViewGuest::RequestNewWindowPermission( | 1371 void WebViewGuest::RequestNewWindowPermission(WindowOpenDisposition disposition, |
| 1375 WindowOpenDisposition disposition, | 1372 const gfx::Rect& initial_bounds, |
| 1376 const gfx::Rect& initial_bounds, | 1373 bool user_gesture, |
| 1377 bool user_gesture, | 1374 WebContents* new_contents) { |
| 1378 content::WebContents* new_contents) { | |
| 1379 auto guest = WebViewGuest::FromWebContents(new_contents); | 1375 auto guest = WebViewGuest::FromWebContents(new_contents); |
| 1380 if (!guest) | 1376 if (!guest) |
| 1381 return; | 1377 return; |
| 1382 auto it = pending_new_windows_.find(guest); | 1378 auto it = pending_new_windows_.find(guest); |
| 1383 if (it == pending_new_windows_.end()) | 1379 if (it == pending_new_windows_.end()) |
| 1384 return; | 1380 return; |
| 1385 const NewWindowInfo& new_window_info = it->second; | 1381 const NewWindowInfo& new_window_info = it->second; |
| 1386 | 1382 |
| 1387 // Retrieve the opener partition info if we have it. | 1383 // Retrieve the opener partition info if we have it. |
| 1388 const GURL& site_url = new_contents->GetSiteInstance()->GetSiteURL(); | 1384 const GURL& site_url = new_contents->GetSiteInstance()->GetSiteURL(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1460 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 1465 DispatchEventToView( | 1461 DispatchEventToView( |
| 1466 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); | 1462 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); |
| 1467 } | 1463 } |
| 1468 // Since we changed fullscreen state, sending a Resize message ensures that | 1464 // Since we changed fullscreen state, sending a Resize message ensures that |
| 1469 // renderer/ sees the change. | 1465 // renderer/ sees the change. |
| 1470 web_contents()->GetRenderViewHost()->WasResized(); | 1466 web_contents()->GetRenderViewHost()->WasResized(); |
| 1471 } | 1467 } |
| 1472 | 1468 |
| 1473 } // namespace extensions | 1469 } // namespace extensions |
| OLD | NEW |