| 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 "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 308 } |
| 309 | 309 |
| 310 void WebViewGuest::AttachWebViewHelpers(WebContents* contents) { | 310 void WebViewGuest::AttachWebViewHelpers(WebContents* contents) { |
| 311 if (web_view_guest_delegate_) | 311 if (web_view_guest_delegate_) |
| 312 web_view_guest_delegate_->OnAttachWebViewHelpers(contents); | 312 web_view_guest_delegate_->OnAttachWebViewHelpers(contents); |
| 313 web_view_permission_helper_.reset(new WebViewPermissionHelper(this)); | 313 web_view_permission_helper_.reset(new WebViewPermissionHelper(this)); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void WebViewGuest::DidStopLoading() { | 316 void WebViewGuest::DidStopLoading() { |
| 317 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 317 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 318 DispatchEventToEmbedder( | 318 DispatchEventToView( |
| 319 new GuestViewBase::Event(webview::kEventLoadStop, args.Pass())); | 319 new GuestViewBase::Event(webview::kEventLoadStop, args.Pass())); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void WebViewGuest::EmbedderWillBeDestroyed() { | 322 void WebViewGuest::EmbedderWillBeDestroyed() { |
| 323 // Clean up rules registries for the webview. | 323 // Clean up rules registries for the webview. |
| 324 RulesRegistryService::Get(browser_context()) | 324 RulesRegistryService::Get(browser_context()) |
| 325 ->RemoveRulesRegistriesByID(rules_registry_id_); | 325 ->RemoveRulesRegistriesByID(rules_registry_id_); |
| 326 WebViewKey key(owner_web_contents()->GetRenderProcessHost()->GetID(), | 326 WebViewKey key(owner_web_contents()->GetRenderProcessHost()->GetID(), |
| 327 view_instance_id()); | 327 view_instance_id()); |
| 328 web_view_key_to_id_map.Get().erase(key); | 328 web_view_key_to_id_map.Get().erase(key); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 | 367 |
| 368 void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, | 368 void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, |
| 369 const gfx::Size& new_size) { | 369 const gfx::Size& new_size) { |
| 370 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 370 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 371 args->SetInteger(webview::kOldHeight, old_size.height()); | 371 args->SetInteger(webview::kOldHeight, old_size.height()); |
| 372 args->SetInteger(webview::kOldWidth, old_size.width()); | 372 args->SetInteger(webview::kOldWidth, old_size.width()); |
| 373 args->SetInteger(webview::kNewHeight, new_size.height()); | 373 args->SetInteger(webview::kNewHeight, new_size.height()); |
| 374 args->SetInteger(webview::kNewWidth, new_size.width()); | 374 args->SetInteger(webview::kNewWidth, new_size.width()); |
| 375 DispatchEventToEmbedder( | 375 DispatchEventToView( |
| 376 new GuestViewBase::Event(webview::kEventSizeChanged, args.Pass())); | 376 new GuestViewBase::Event(webview::kEventSizeChanged, args.Pass())); |
| 377 } | 377 } |
| 378 | 378 |
| 379 bool WebViewGuest::IsAutoSizeSupported() const { | 379 bool WebViewGuest::IsAutoSizeSupported() const { |
| 380 return true; | 380 return true; |
| 381 } | 381 } |
| 382 | 382 |
| 383 bool WebViewGuest::IsDragAndDropEnabled() const { | 383 bool WebViewGuest::IsDragAndDropEnabled() const { |
| 384 return true; | 384 return true; |
| 385 } | 385 } |
| 386 | 386 |
| 387 void WebViewGuest::WillDestroy() { | 387 void WebViewGuest::WillDestroy() { |
| 388 if (!attached() && GetOpener()) | 388 if (!attached() && GetOpener()) |
| 389 GetOpener()->pending_new_windows_.erase(this); | 389 GetOpener()->pending_new_windows_.erase(this); |
| 390 } | 390 } |
| 391 | 391 |
| 392 bool WebViewGuest::AddMessageToConsole(WebContents* source, | 392 bool WebViewGuest::AddMessageToConsole(WebContents* source, |
| 393 int32 level, | 393 int32 level, |
| 394 const base::string16& message, | 394 const base::string16& message, |
| 395 int32 line_no, | 395 int32 line_no, |
| 396 const base::string16& source_id) { | 396 const base::string16& source_id) { |
| 397 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 397 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 398 // Log levels are from base/logging.h: LogSeverity. | 398 // Log levels are from base/logging.h: LogSeverity. |
| 399 args->SetInteger(webview::kLevel, level); | 399 args->SetInteger(webview::kLevel, level); |
| 400 args->SetString(webview::kMessage, message); | 400 args->SetString(webview::kMessage, message); |
| 401 args->SetInteger(webview::kLine, line_no); | 401 args->SetInteger(webview::kLine, line_no); |
| 402 args->SetString(webview::kSourceId, source_id); | 402 args->SetString(webview::kSourceId, source_id); |
| 403 DispatchEventToEmbedder( | 403 DispatchEventToView( |
| 404 new GuestViewBase::Event(webview::kEventConsoleMessage, args.Pass())); | 404 new GuestViewBase::Event(webview::kEventConsoleMessage, args.Pass())); |
| 405 return true; | 405 return true; |
| 406 } | 406 } |
| 407 | 407 |
| 408 void WebViewGuest::CloseContents(WebContents* source) { | 408 void WebViewGuest::CloseContents(WebContents* source) { |
| 409 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 409 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 410 DispatchEventToEmbedder( | 410 DispatchEventToView( |
| 411 new GuestViewBase::Event(webview::kEventClose, args.Pass())); | 411 new GuestViewBase::Event(webview::kEventClose, args.Pass())); |
| 412 } | 412 } |
| 413 | 413 |
| 414 void WebViewGuest::FindReply(WebContents* source, | 414 void WebViewGuest::FindReply(WebContents* source, |
| 415 int request_id, | 415 int request_id, |
| 416 int number_of_matches, | 416 int number_of_matches, |
| 417 const gfx::Rect& selection_rect, | 417 const gfx::Rect& selection_rect, |
| 418 int active_match_ordinal, | 418 int active_match_ordinal, |
| 419 bool final_update) { | 419 bool final_update) { |
| 420 find_helper_.FindReply(request_id, | 420 find_helper_.FindReply(request_id, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 448 // See http://crbug.com/229882. | 448 // See http://crbug.com/229882. |
| 449 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent( | 449 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent( |
| 450 web_contents(), event); | 450 web_contents(), event); |
| 451 } | 451 } |
| 452 | 452 |
| 453 void WebViewGuest::LoadProgressChanged(content::WebContents* source, | 453 void WebViewGuest::LoadProgressChanged(content::WebContents* source, |
| 454 double progress) { | 454 double progress) { |
| 455 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 455 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 456 args->SetString(guestview::kUrl, web_contents()->GetURL().spec()); | 456 args->SetString(guestview::kUrl, web_contents()->GetURL().spec()); |
| 457 args->SetDouble(webview::kProgress, progress); | 457 args->SetDouble(webview::kProgress, progress); |
| 458 DispatchEventToEmbedder( | 458 DispatchEventToView( |
| 459 new GuestViewBase::Event(webview::kEventLoadProgress, args.Pass())); | 459 new GuestViewBase::Event(webview::kEventLoadProgress, args.Pass())); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void WebViewGuest::LoadAbort(bool is_top_level, | 462 void WebViewGuest::LoadAbort(bool is_top_level, |
| 463 const GURL& url, | 463 const GURL& url, |
| 464 const std::string& error_type) { | 464 const std::string& error_type) { |
| 465 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 465 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 466 args->SetBoolean(guestview::kIsTopLevel, is_top_level); | 466 args->SetBoolean(guestview::kIsTopLevel, is_top_level); |
| 467 args->SetString(guestview::kUrl, url.possibly_invalid_spec()); | 467 args->SetString(guestview::kUrl, url.possibly_invalid_spec()); |
| 468 args->SetString(guestview::kReason, error_type); | 468 args->SetString(guestview::kReason, error_type); |
| 469 DispatchEventToEmbedder( | 469 DispatchEventToView( |
| 470 new GuestViewBase::Event(webview::kEventLoadAbort, args.Pass())); | 470 new GuestViewBase::Event(webview::kEventLoadAbort, args.Pass())); |
| 471 } | 471 } |
| 472 | 472 |
| 473 void WebViewGuest::OnFrameNameChanged(bool is_top_level, | 473 void WebViewGuest::OnFrameNameChanged(bool is_top_level, |
| 474 const std::string& name) { | 474 const std::string& name) { |
| 475 if (!is_top_level) | 475 if (!is_top_level) |
| 476 return; | 476 return; |
| 477 | 477 |
| 478 if (name_ == name) | 478 if (name_ == name) |
| 479 return; | 479 return; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 params.user_gesture, | 522 params.user_gesture, |
| 523 new_guest->web_contents()); | 523 new_guest->web_contents()); |
| 524 } | 524 } |
| 525 | 525 |
| 526 // TODO(fsamuel): Find a reliable way to test the 'responsive' and | 526 // TODO(fsamuel): Find a reliable way to test the 'responsive' and |
| 527 // 'unresponsive' events. | 527 // 'unresponsive' events. |
| 528 void WebViewGuest::RendererResponsive(content::WebContents* source) { | 528 void WebViewGuest::RendererResponsive(content::WebContents* source) { |
| 529 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 529 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 530 args->SetInteger(webview::kProcessId, | 530 args->SetInteger(webview::kProcessId, |
| 531 web_contents()->GetRenderProcessHost()->GetID()); | 531 web_contents()->GetRenderProcessHost()->GetID()); |
| 532 DispatchEventToEmbedder( | 532 DispatchEventToView( |
| 533 new GuestViewBase::Event(webview::kEventResponsive, args.Pass())); | 533 new GuestViewBase::Event(webview::kEventResponsive, args.Pass())); |
| 534 } | 534 } |
| 535 | 535 |
| 536 void WebViewGuest::RendererUnresponsive(content::WebContents* source) { | 536 void WebViewGuest::RendererUnresponsive(content::WebContents* source) { |
| 537 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 537 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 538 args->SetInteger(webview::kProcessId, | 538 args->SetInteger(webview::kProcessId, |
| 539 web_contents()->GetRenderProcessHost()->GetID()); | 539 web_contents()->GetRenderProcessHost()->GetID()); |
| 540 DispatchEventToEmbedder( | 540 DispatchEventToView( |
| 541 new GuestViewBase::Event(webview::kEventUnresponsive, args.Pass())); | 541 new GuestViewBase::Event(webview::kEventUnresponsive, args.Pass())); |
| 542 } | 542 } |
| 543 | 543 |
| 544 void WebViewGuest::Observe(int type, | 544 void WebViewGuest::Observe(int type, |
| 545 const content::NotificationSource& source, | 545 const content::NotificationSource& source, |
| 546 const content::NotificationDetails& details) { | 546 const content::NotificationDetails& details) { |
| 547 switch (type) { | 547 switch (type) { |
| 548 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: { | 548 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: { |
| 549 DCHECK_EQ(content::Source<WebContents>(source).ptr(), web_contents()); | 549 DCHECK_EQ(content::Source<WebContents>(source).ptr(), web_contents()); |
| 550 if (content::Source<WebContents>(source).ptr() == web_contents()) | 550 if (content::Source<WebContents>(source).ptr() == web_contents()) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 ->GetController() | 672 ->GetController() |
| 673 .GetLastCommittedEntry() | 673 .GetLastCommittedEntry() |
| 674 ->GetBaseURLForDataURL() | 674 ->GetBaseURLForDataURL() |
| 675 .spec()); | 675 .spec()); |
| 676 args->SetInteger(webview::kInternalCurrentEntryIndex, | 676 args->SetInteger(webview::kInternalCurrentEntryIndex, |
| 677 web_contents()->GetController().GetCurrentEntryIndex()); | 677 web_contents()->GetController().GetCurrentEntryIndex()); |
| 678 args->SetInteger(webview::kInternalEntryCount, | 678 args->SetInteger(webview::kInternalEntryCount, |
| 679 web_contents()->GetController().GetEntryCount()); | 679 web_contents()->GetController().GetEntryCount()); |
| 680 args->SetInteger(webview::kInternalProcessId, | 680 args->SetInteger(webview::kInternalProcessId, |
| 681 web_contents()->GetRenderProcessHost()->GetID()); | 681 web_contents()->GetRenderProcessHost()->GetID()); |
| 682 DispatchEventToEmbedder( | 682 DispatchEventToView( |
| 683 new GuestViewBase::Event(webview::kEventLoadCommit, args.Pass())); | 683 new GuestViewBase::Event(webview::kEventLoadCommit, args.Pass())); |
| 684 | 684 |
| 685 find_helper_.CancelAllFindSessions(); | 685 find_helper_.CancelAllFindSessions(); |
| 686 | 686 |
| 687 // Update the current zoom factor for the new page. | 687 // Update the current zoom factor for the new page. |
| 688 ui_zoom::ZoomController* zoom_controller = | 688 ui_zoom::ZoomController* zoom_controller = |
| 689 ui_zoom::ZoomController::FromWebContents(web_contents()); | 689 ui_zoom::ZoomController::FromWebContents(web_contents()); |
| 690 DCHECK(zoom_controller); | 690 DCHECK(zoom_controller); |
| 691 current_zoom_factor_ = | 691 current_zoom_factor_ = |
| 692 content::ZoomLevelToZoomFactor(zoom_controller->GetZoomLevel()); | 692 content::ZoomLevelToZoomFactor(zoom_controller->GetZoomLevel()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 707 } | 707 } |
| 708 | 708 |
| 709 void WebViewGuest::DidStartProvisionalLoadForFrame( | 709 void WebViewGuest::DidStartProvisionalLoadForFrame( |
| 710 content::RenderFrameHost* render_frame_host, | 710 content::RenderFrameHost* render_frame_host, |
| 711 const GURL& validated_url, | 711 const GURL& validated_url, |
| 712 bool is_error_page, | 712 bool is_error_page, |
| 713 bool is_iframe_srcdoc) { | 713 bool is_iframe_srcdoc) { |
| 714 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 714 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 715 args->SetString(guestview::kUrl, validated_url.spec()); | 715 args->SetString(guestview::kUrl, validated_url.spec()); |
| 716 args->SetBoolean(guestview::kIsTopLevel, !render_frame_host->GetParent()); | 716 args->SetBoolean(guestview::kIsTopLevel, !render_frame_host->GetParent()); |
| 717 DispatchEventToEmbedder( | 717 DispatchEventToView( |
| 718 new GuestViewBase::Event(webview::kEventLoadStart, args.Pass())); | 718 new GuestViewBase::Event(webview::kEventLoadStart, args.Pass())); |
| 719 } | 719 } |
| 720 | 720 |
| 721 void WebViewGuest::DocumentLoadedInFrame( | 721 void WebViewGuest::DocumentLoadedInFrame( |
| 722 content::RenderFrameHost* render_frame_host) { | 722 content::RenderFrameHost* render_frame_host) { |
| 723 if (web_view_guest_delegate_) | 723 if (web_view_guest_delegate_) |
| 724 web_view_guest_delegate_->OnDocumentLoadedInFrame(render_frame_host); | 724 web_view_guest_delegate_->OnDocumentLoadedInFrame(render_frame_host); |
| 725 } | 725 } |
| 726 | 726 |
| 727 bool WebViewGuest::OnMessageReceived(const IPC::Message& message, | 727 bool WebViewGuest::OnMessageReceived(const IPC::Message& message, |
| 728 RenderFrameHost* render_frame_host) { | 728 RenderFrameHost* render_frame_host) { |
| 729 bool handled = true; | 729 bool handled = true; |
| 730 IPC_BEGIN_MESSAGE_MAP(WebViewGuest, message) | 730 IPC_BEGIN_MESSAGE_MAP(WebViewGuest, message) |
| 731 IPC_MESSAGE_HANDLER(ExtensionHostMsg_FrameNameChanged, OnFrameNameChanged) | 731 IPC_MESSAGE_HANDLER(ExtensionHostMsg_FrameNameChanged, OnFrameNameChanged) |
| 732 IPC_MESSAGE_UNHANDLED(handled = false) | 732 IPC_MESSAGE_UNHANDLED(handled = false) |
| 733 IPC_END_MESSAGE_MAP() | 733 IPC_END_MESSAGE_MAP() |
| 734 return handled; | 734 return handled; |
| 735 } | 735 } |
| 736 | 736 |
| 737 void WebViewGuest::RenderProcessGone(base::TerminationStatus status) { | 737 void WebViewGuest::RenderProcessGone(base::TerminationStatus status) { |
| 738 // Cancel all find sessions in progress. | 738 // Cancel all find sessions in progress. |
| 739 find_helper_.CancelAllFindSessions(); | 739 find_helper_.CancelAllFindSessions(); |
| 740 | 740 |
| 741 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 741 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 742 args->SetInteger(webview::kProcessId, | 742 args->SetInteger(webview::kProcessId, |
| 743 web_contents()->GetRenderProcessHost()->GetID()); | 743 web_contents()->GetRenderProcessHost()->GetID()); |
| 744 args->SetString(webview::kReason, TerminationStatusToString(status)); | 744 args->SetString(webview::kReason, TerminationStatusToString(status)); |
| 745 DispatchEventToEmbedder( | 745 DispatchEventToView( |
| 746 new GuestViewBase::Event(webview::kEventExit, args.Pass())); | 746 new GuestViewBase::Event(webview::kEventExit, args.Pass())); |
| 747 } | 747 } |
| 748 | 748 |
| 749 void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) { | 749 void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) { |
| 750 content::NavigationController& controller = web_contents()->GetController(); | 750 content::NavigationController& controller = web_contents()->GetController(); |
| 751 content::NavigationEntry* entry = controller.GetVisibleEntry(); | 751 content::NavigationEntry* entry = controller.GetVisibleEntry(); |
| 752 if (!entry) | 752 if (!entry) |
| 753 return; | 753 return; |
| 754 entry->SetIsOverridingUserAgent(!user_agent.empty()); | 754 entry->SetIsOverridingUserAgent(!user_agent.empty()); |
| 755 web_contents()->GetController().Reload(false); | 755 web_contents()->GetController().Reload(false); |
| 756 } | 756 } |
| 757 | 757 |
| 758 void WebViewGuest::ReportFrameNameChange(const std::string& name) { | 758 void WebViewGuest::ReportFrameNameChange(const std::string& name) { |
| 759 name_ = name; | 759 name_ = name; |
| 760 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 760 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 761 args->SetString(webview::kName, name); | 761 args->SetString(webview::kName, name); |
| 762 DispatchEventToEmbedder( | 762 DispatchEventToView( |
| 763 new GuestViewBase::Event(webview::kEventFrameNameChanged, args.Pass())); | 763 new GuestViewBase::Event(webview::kEventFrameNameChanged, args.Pass())); |
| 764 } | 764 } |
| 765 | 765 |
| 766 void WebViewGuest::LoadHandlerCalled() { | 766 void WebViewGuest::LoadHandlerCalled() { |
| 767 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 767 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 768 DispatchEventToEmbedder( | 768 DispatchEventToView( |
| 769 new GuestViewBase::Event(webview::kEventContentLoad, args.Pass())); | 769 new GuestViewBase::Event(webview::kEventContentLoad, args.Pass())); |
| 770 } | 770 } |
| 771 | 771 |
| 772 void WebViewGuest::LoadRedirect(const GURL& old_url, | 772 void WebViewGuest::LoadRedirect(const GURL& old_url, |
| 773 const GURL& new_url, | 773 const GURL& new_url, |
| 774 bool is_top_level) { | 774 bool is_top_level) { |
| 775 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 775 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 776 args->SetBoolean(guestview::kIsTopLevel, is_top_level); | 776 args->SetBoolean(guestview::kIsTopLevel, is_top_level); |
| 777 args->SetString(webview::kNewURL, new_url.spec()); | 777 args->SetString(webview::kNewURL, new_url.spec()); |
| 778 args->SetString(webview::kOldURL, old_url.spec()); | 778 args->SetString(webview::kOldURL, old_url.spec()); |
| 779 DispatchEventToEmbedder( | 779 DispatchEventToView( |
| 780 new GuestViewBase::Event(webview::kEventLoadRedirect, args.Pass())); | 780 new GuestViewBase::Event(webview::kEventLoadRedirect, args.Pass())); |
| 781 } | 781 } |
| 782 | 782 |
| 783 void WebViewGuest::PushWebViewStateToIOThread() { | 783 void WebViewGuest::PushWebViewStateToIOThread() { |
| 784 const GURL& site_url = web_contents()->GetSiteInstance()->GetSiteURL(); | 784 const GURL& site_url = web_contents()->GetSiteInstance()->GetSiteURL(); |
| 785 std::string partition_domain; | 785 std::string partition_domain; |
| 786 std::string partition_id; | 786 std::string partition_id; |
| 787 bool in_memory; | 787 bool in_memory; |
| 788 if (!GetGuestPartitionConfigForSite( | 788 if (!GetGuestPartitionConfigForSite( |
| 789 site_url, &partition_domain, &partition_id, &in_memory)) { | 789 site_url, &partition_domain, &partition_id, &in_memory)) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 void WebViewGuest::SetZoom(double zoom_factor) { | 1030 void WebViewGuest::SetZoom(double zoom_factor) { |
| 1031 auto zoom_controller = | 1031 auto zoom_controller = |
| 1032 ui_zoom::ZoomController::FromWebContents(web_contents()); | 1032 ui_zoom::ZoomController::FromWebContents(web_contents()); |
| 1033 DCHECK(zoom_controller); | 1033 DCHECK(zoom_controller); |
| 1034 double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor); | 1034 double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor); |
| 1035 zoom_controller->SetZoomLevel(zoom_level); | 1035 zoom_controller->SetZoomLevel(zoom_level); |
| 1036 | 1036 |
| 1037 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1037 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 1038 args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_); | 1038 args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_); |
| 1039 args->SetDouble(webview::kNewZoomFactor, zoom_factor); | 1039 args->SetDouble(webview::kNewZoomFactor, zoom_factor); |
| 1040 DispatchEventToEmbedder( | 1040 DispatchEventToView( |
| 1041 new GuestViewBase::Event(webview::kEventZoomChange, args.Pass())); | 1041 new GuestViewBase::Event(webview::kEventZoomChange, args.Pass())); |
| 1042 current_zoom_factor_ = zoom_factor; | 1042 current_zoom_factor_ = zoom_factor; |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 void WebViewGuest::SetAllowTransparency(bool allow) { | 1045 void WebViewGuest::SetAllowTransparency(bool allow) { |
| 1046 if (guest_opaque_ != allow) | 1046 if (guest_opaque_ != allow) |
| 1047 return; | 1047 return; |
| 1048 | 1048 |
| 1049 guest_opaque_ = !allow; | 1049 guest_opaque_ = !allow; |
| 1050 if (!web_contents()->GetRenderViewHost()->GetView()) | 1050 if (!web_contents()->GetRenderViewHost()->GetView()) |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 WebViewGuest::From(owner_web_contents()->GetRenderProcessHost()->GetID(), | 1236 WebViewGuest::From(owner_web_contents()->GetRenderProcessHost()->GetID(), |
| 1237 new_window_instance_id); | 1237 new_window_instance_id); |
| 1238 if (!guest) | 1238 if (!guest) |
| 1239 return; | 1239 return; |
| 1240 | 1240 |
| 1241 if (!allow) | 1241 if (!allow) |
| 1242 guest->Destroy(); | 1242 guest->Destroy(); |
| 1243 } | 1243 } |
| 1244 | 1244 |
| 1245 } // namespace extensions | 1245 } // namespace extensions |
| OLD | NEW |