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