Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 2252373002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 callback.Run(WebContents::Create(params)); 367 callback.Run(WebContents::Create(params));
368 } 368 }
369 369
370 void WebViewGuest::DidAttachToEmbedder() { 370 void WebViewGuest::DidAttachToEmbedder() {
371 ApplyAttributes(*attach_params()); 371 ApplyAttributes(*attach_params());
372 } 372 }
373 373
374 void WebViewGuest::DidDropLink(const GURL& url) { 374 void WebViewGuest::DidDropLink(const GURL& url) {
375 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 375 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
376 args->SetString(guest_view::kUrl, url.spec()); 376 args->SetString(guest_view::kUrl, url.spec());
377 DispatchEventToView(base::WrapUnique( 377 DispatchEventToView(base::MakeUnique<GuestViewEvent>(webview::kEventDropLink,
378 new GuestViewEvent(webview::kEventDropLink, std::move(args)))); 378 std::move(args)));
379 } 379 }
380 380
381 void WebViewGuest::DidInitialize(const base::DictionaryValue& create_params) { 381 void WebViewGuest::DidInitialize(const base::DictionaryValue& create_params) {
382 script_executor_.reset( 382 script_executor_.reset(
383 new ScriptExecutor(web_contents(), &script_observers_)); 383 new ScriptExecutor(web_contents(), &script_observers_));
384 384
385 notification_registrar_.Add(this, 385 notification_registrar_.Add(this,
386 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 386 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
387 content::Source<WebContents>(web_contents())); 387 content::Source<WebContents>(web_contents()));
388 388
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 web_contents()->GetSiteInstance()); 422 web_contents()->GetSiteInstance());
423 partition->ClearData( 423 partition->ClearData(
424 storage_partition_removal_mask, 424 storage_partition_removal_mask,
425 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, GURL(), 425 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, GURL(),
426 content::StoragePartition::OriginMatcherFunction(), remove_since, 426 content::StoragePartition::OriginMatcherFunction(), remove_since,
427 base::Time::Now(), callback); 427 base::Time::Now(), callback);
428 } 428 }
429 429
430 void WebViewGuest::GuestViewDidStopLoading() { 430 void WebViewGuest::GuestViewDidStopLoading() {
431 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 431 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
432 DispatchEventToView(base::WrapUnique( 432 DispatchEventToView(base::MakeUnique<GuestViewEvent>(webview::kEventLoadStop,
433 new GuestViewEvent(webview::kEventLoadStop, std::move(args)))); 433 std::move(args)));
434 } 434 }
435 435
436 void WebViewGuest::EmbedderFullscreenToggled(bool entered_fullscreen) { 436 void WebViewGuest::EmbedderFullscreenToggled(bool entered_fullscreen) {
437 is_embedder_fullscreen_ = entered_fullscreen; 437 is_embedder_fullscreen_ = entered_fullscreen;
438 // If the embedder has got out of fullscreen, we get out of fullscreen 438 // If the embedder has got out of fullscreen, we get out of fullscreen
439 // mode as well. 439 // mode as well.
440 if (!entered_fullscreen) 440 if (!entered_fullscreen)
441 SetFullscreenState(false); 441 SetFullscreenState(false);
442 } 442 }
443 443
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 477 }
478 } 478 }
479 479
480 void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, 480 void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size,
481 const gfx::Size& new_size) { 481 const gfx::Size& new_size) {
482 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 482 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
483 args->SetInteger(webview::kOldHeight, old_size.height()); 483 args->SetInteger(webview::kOldHeight, old_size.height());
484 args->SetInteger(webview::kOldWidth, old_size.width()); 484 args->SetInteger(webview::kOldWidth, old_size.width());
485 args->SetInteger(webview::kNewHeight, new_size.height()); 485 args->SetInteger(webview::kNewHeight, new_size.height());
486 args->SetInteger(webview::kNewWidth, new_size.width()); 486 args->SetInteger(webview::kNewWidth, new_size.width());
487 DispatchEventToView(base::WrapUnique( 487 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
488 new GuestViewEvent(webview::kEventSizeChanged, std::move(args)))); 488 webview::kEventSizeChanged, std::move(args)));
489 } 489 }
490 490
491 bool WebViewGuest::IsAutoSizeSupported() const { 491 bool WebViewGuest::IsAutoSizeSupported() const {
492 return true; 492 return true;
493 } 493 }
494 494
495 void WebViewGuest::GuestZoomChanged(double old_zoom_level, 495 void WebViewGuest::GuestZoomChanged(double old_zoom_level,
496 double new_zoom_level) { 496 double new_zoom_level) {
497 // Dispatch the zoomchange event. 497 // Dispatch the zoomchange event.
498 double old_zoom_factor = ConvertZoomLevelToZoomFactor(old_zoom_level); 498 double old_zoom_factor = ConvertZoomLevelToZoomFactor(old_zoom_level);
499 double new_zoom_factor = ConvertZoomLevelToZoomFactor(new_zoom_level); 499 double new_zoom_factor = ConvertZoomLevelToZoomFactor(new_zoom_level);
500 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 500 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
501 args->SetDouble(webview::kOldZoomFactor, old_zoom_factor); 501 args->SetDouble(webview::kOldZoomFactor, old_zoom_factor);
502 args->SetDouble(webview::kNewZoomFactor, new_zoom_factor); 502 args->SetDouble(webview::kNewZoomFactor, new_zoom_factor);
503 DispatchEventToView(base::WrapUnique( 503 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
504 new GuestViewEvent(webview::kEventZoomChange, std::move(args)))); 504 webview::kEventZoomChange, std::move(args)));
505 } 505 }
506 506
507 void WebViewGuest::WillDestroy() { 507 void WebViewGuest::WillDestroy() {
508 if (!attached() && GetOpener()) 508 if (!attached() && GetOpener())
509 GetOpener()->pending_new_windows_.erase(this); 509 GetOpener()->pending_new_windows_.erase(this);
510 } 510 }
511 511
512 bool WebViewGuest::AddMessageToConsole(WebContents* source, 512 bool WebViewGuest::AddMessageToConsole(WebContents* source,
513 int32_t level, 513 int32_t level,
514 const base::string16& message, 514 const base::string16& message,
515 int32_t line_no, 515 int32_t line_no,
516 const base::string16& source_id) { 516 const base::string16& source_id) {
517 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 517 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
518 // Log levels are from base/logging.h: LogSeverity. 518 // Log levels are from base/logging.h: LogSeverity.
519 args->SetInteger(webview::kLevel, level); 519 args->SetInteger(webview::kLevel, level);
520 args->SetString(webview::kMessage, message); 520 args->SetString(webview::kMessage, message);
521 args->SetInteger(webview::kLine, line_no); 521 args->SetInteger(webview::kLine, line_no);
522 args->SetString(webview::kSourceId, source_id); 522 args->SetString(webview::kSourceId, source_id);
523 DispatchEventToView(base::WrapUnique( 523 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
524 new GuestViewEvent(webview::kEventConsoleMessage, std::move(args)))); 524 webview::kEventConsoleMessage, std::move(args)));
525 return true; 525 return true;
526 } 526 }
527 527
528 void WebViewGuest::CloseContents(WebContents* source) { 528 void WebViewGuest::CloseContents(WebContents* source) {
529 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 529 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
530 DispatchEventToView(base::WrapUnique( 530 DispatchEventToView(
531 new GuestViewEvent(webview::kEventClose, std::move(args)))); 531 base::MakeUnique<GuestViewEvent>(webview::kEventClose, std::move(args)));
532 } 532 }
533 533
534 void WebViewGuest::FindReply(WebContents* source, 534 void WebViewGuest::FindReply(WebContents* source,
535 int request_id, 535 int request_id,
536 int number_of_matches, 536 int number_of_matches,
537 const gfx::Rect& selection_rect, 537 const gfx::Rect& selection_rect,
538 int active_match_ordinal, 538 int active_match_ordinal,
539 bool final_update) { 539 bool final_update) {
540 GuestViewBase::FindReply(source, request_id, number_of_matches, 540 GuestViewBase::FindReply(source, request_id, number_of_matches,
541 selection_rect, active_match_ordinal, final_update); 541 selection_rect, active_match_ordinal, final_update);
(...skipping 29 matching lines...) Expand all
571 571
572 bool WebViewGuest::PreHandleGestureEvent(WebContents* source, 572 bool WebViewGuest::PreHandleGestureEvent(WebContents* source,
573 const blink::WebGestureEvent& event) { 573 const blink::WebGestureEvent& event) {
574 return !allow_scaling_ && GuestViewBase::PreHandleGestureEvent(source, event); 574 return !allow_scaling_ && GuestViewBase::PreHandleGestureEvent(source, event);
575 } 575 }
576 576
577 void WebViewGuest::LoadProgressChanged(WebContents* source, double progress) { 577 void WebViewGuest::LoadProgressChanged(WebContents* source, double progress) {
578 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 578 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
579 args->SetString(guest_view::kUrl, web_contents()->GetURL().spec()); 579 args->SetString(guest_view::kUrl, web_contents()->GetURL().spec());
580 args->SetDouble(webview::kProgress, progress); 580 args->SetDouble(webview::kProgress, progress);
581 DispatchEventToView(base::WrapUnique( 581 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
582 new GuestViewEvent(webview::kEventLoadProgress, std::move(args)))); 582 webview::kEventLoadProgress, std::move(args)));
583 } 583 }
584 584
585 void WebViewGuest::LoadAbort(bool is_top_level, 585 void WebViewGuest::LoadAbort(bool is_top_level,
586 const GURL& url, 586 const GURL& url,
587 int error_code, 587 int error_code,
588 const std::string& error_type) { 588 const std::string& error_type) {
589 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 589 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
590 args->SetBoolean(guest_view::kIsTopLevel, is_top_level); 590 args->SetBoolean(guest_view::kIsTopLevel, is_top_level);
591 args->SetString(guest_view::kUrl, url.possibly_invalid_spec()); 591 args->SetString(guest_view::kUrl, url.possibly_invalid_spec());
592 args->SetInteger(guest_view::kCode, error_code); 592 args->SetInteger(guest_view::kCode, error_code);
593 args->SetString(guest_view::kReason, error_type); 593 args->SetString(guest_view::kReason, error_type);
594 DispatchEventToView(base::WrapUnique( 594 DispatchEventToView(base::MakeUnique<GuestViewEvent>(webview::kEventLoadAbort,
595 new GuestViewEvent(webview::kEventLoadAbort, std::move(args)))); 595 std::move(args)));
596 } 596 }
597 597
598 void WebViewGuest::SetContextMenuPosition(const gfx::Point& position) { 598 void WebViewGuest::SetContextMenuPosition(const gfx::Point& position) {
599 if (web_view_guest_delegate_) 599 if (web_view_guest_delegate_)
600 web_view_guest_delegate_->SetContextMenuPosition(position); 600 web_view_guest_delegate_->SetContextMenuPosition(position);
601 } 601 }
602 602
603 void WebViewGuest::CreateNewGuestWebViewWindow( 603 void WebViewGuest::CreateNewGuestWebViewWindow(
604 const content::OpenURLParams& params) { 604 const content::OpenURLParams& params) {
605 GuestViewManager* guest_manager = 605 GuestViewManager* guest_manager =
(...skipping 30 matching lines...) Expand all
636 params.user_gesture, 636 params.user_gesture,
637 new_guest->web_contents()); 637 new_guest->web_contents());
638 } 638 }
639 639
640 // TODO(fsamuel): Find a reliable way to test the 'responsive' and 640 // TODO(fsamuel): Find a reliable way to test the 'responsive' and
641 // 'unresponsive' events. 641 // 'unresponsive' events.
642 void WebViewGuest::RendererResponsive(WebContents* source) { 642 void WebViewGuest::RendererResponsive(WebContents* source) {
643 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 643 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
644 args->SetInteger(webview::kProcessId, 644 args->SetInteger(webview::kProcessId,
645 web_contents()->GetRenderProcessHost()->GetID()); 645 web_contents()->GetRenderProcessHost()->GetID());
646 DispatchEventToView(base::WrapUnique( 646 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
647 new GuestViewEvent(webview::kEventResponsive, std::move(args)))); 647 webview::kEventResponsive, std::move(args)));
648 } 648 }
649 649
650 void WebViewGuest::RendererUnresponsive(WebContents* source) { 650 void WebViewGuest::RendererUnresponsive(WebContents* source) {
651 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 651 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
652 args->SetInteger(webview::kProcessId, 652 args->SetInteger(webview::kProcessId,
653 web_contents()->GetRenderProcessHost()->GetID()); 653 web_contents()->GetRenderProcessHost()->GetID());
654 DispatchEventToView(base::WrapUnique( 654 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
655 new GuestViewEvent(webview::kEventUnresponsive, std::move(args)))); 655 webview::kEventUnresponsive, std::move(args)));
656 } 656 }
657 657
658 void WebViewGuest::Observe(int type, 658 void WebViewGuest::Observe(int type,
659 const content::NotificationSource& source, 659 const content::NotificationSource& source,
660 const content::NotificationDetails& details) { 660 const content::NotificationDetails& details) {
661 switch (type) { 661 switch (type) {
662 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: { 662 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: {
663 DCHECK_EQ(content::Source<WebContents>(source).ptr(), web_contents()); 663 DCHECK_EQ(content::Source<WebContents>(source).ptr(), web_contents());
664 if (content::Source<WebContents>(source).ptr() == web_contents()) 664 if (content::Source<WebContents>(source).ptr() == web_contents())
665 LoadHandlerCalled(); 665 LoadHandlerCalled();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 ->GetController() 811 ->GetController()
812 .GetLastCommittedEntry() 812 .GetLastCommittedEntry()
813 ->GetBaseURLForDataURL() 813 ->GetBaseURLForDataURL()
814 .spec()); 814 .spec());
815 args->SetInteger(webview::kInternalCurrentEntryIndex, 815 args->SetInteger(webview::kInternalCurrentEntryIndex,
816 web_contents()->GetController().GetCurrentEntryIndex()); 816 web_contents()->GetController().GetCurrentEntryIndex());
817 args->SetInteger(webview::kInternalEntryCount, 817 args->SetInteger(webview::kInternalEntryCount,
818 web_contents()->GetController().GetEntryCount()); 818 web_contents()->GetController().GetEntryCount());
819 args->SetInteger(webview::kInternalProcessId, 819 args->SetInteger(webview::kInternalProcessId,
820 web_contents()->GetRenderProcessHost()->GetID()); 820 web_contents()->GetRenderProcessHost()->GetID());
821 DispatchEventToView(base::WrapUnique( 821 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
822 new GuestViewEvent(webview::kEventLoadCommit, std::move(args)))); 822 webview::kEventLoadCommit, std::move(args)));
823 823
824 find_helper_.CancelAllFindSessions(); 824 find_helper_.CancelAllFindSessions();
825 } 825 }
826 826
827 void WebViewGuest::DidFailProvisionalLoad( 827 void WebViewGuest::DidFailProvisionalLoad(
828 content::RenderFrameHost* render_frame_host, 828 content::RenderFrameHost* render_frame_host,
829 const GURL& validated_url, 829 const GURL& validated_url,
830 int error_code, 830 int error_code,
831 const base::string16& error_description, 831 const base::string16& error_description,
832 bool was_ignored_by_handler) { 832 bool was_ignored_by_handler) {
833 // Suppress loadabort for "mailto" URLs. 833 // Suppress loadabort for "mailto" URLs.
834 if (validated_url.SchemeIs(url::kMailToScheme)) 834 if (validated_url.SchemeIs(url::kMailToScheme))
835 return; 835 return;
836 836
837 LoadAbort(!render_frame_host->GetParent(), validated_url, error_code, 837 LoadAbort(!render_frame_host->GetParent(), validated_url, error_code,
838 net::ErrorToShortString(error_code)); 838 net::ErrorToShortString(error_code));
839 } 839 }
840 840
841 void WebViewGuest::DidStartProvisionalLoadForFrame( 841 void WebViewGuest::DidStartProvisionalLoadForFrame(
842 content::RenderFrameHost* render_frame_host, 842 content::RenderFrameHost* render_frame_host,
843 const GURL& validated_url, 843 const GURL& validated_url,
844 bool is_error_page, 844 bool is_error_page,
845 bool is_iframe_srcdoc) { 845 bool is_iframe_srcdoc) {
846 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 846 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
847 args->SetString(guest_view::kUrl, validated_url.spec()); 847 args->SetString(guest_view::kUrl, validated_url.spec());
848 args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent()); 848 args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent());
849 DispatchEventToView(base::WrapUnique( 849 DispatchEventToView(base::MakeUnique<GuestViewEvent>(webview::kEventLoadStart,
850 new GuestViewEvent(webview::kEventLoadStart, std::move(args)))); 850 std::move(args)));
851 } 851 }
852 852
853 void WebViewGuest::RenderProcessGone(base::TerminationStatus status) { 853 void WebViewGuest::RenderProcessGone(base::TerminationStatus status) {
854 // Cancel all find sessions in progress. 854 // Cancel all find sessions in progress.
855 find_helper_.CancelAllFindSessions(); 855 find_helper_.CancelAllFindSessions();
856 856
857 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 857 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
858 args->SetInteger(webview::kProcessId, 858 args->SetInteger(webview::kProcessId,
859 web_contents()->GetRenderProcessHost()->GetID()); 859 web_contents()->GetRenderProcessHost()->GetID());
860 args->SetString(webview::kReason, TerminationStatusToString(status)); 860 args->SetString(webview::kReason, TerminationStatusToString(status));
861 DispatchEventToView(base::WrapUnique( 861 DispatchEventToView(
862 new GuestViewEvent(webview::kEventExit, std::move(args)))); 862 base::MakeUnique<GuestViewEvent>(webview::kEventExit, std::move(args)));
863 } 863 }
864 864
865 void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) { 865 void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) {
866 content::NavigationController& controller = web_contents()->GetController(); 866 content::NavigationController& controller = web_contents()->GetController();
867 content::NavigationEntry* entry = controller.GetVisibleEntry(); 867 content::NavigationEntry* entry = controller.GetVisibleEntry();
868 if (!entry) 868 if (!entry)
869 return; 869 return;
870 entry->SetIsOverridingUserAgent(!user_agent.empty()); 870 entry->SetIsOverridingUserAgent(!user_agent.empty());
871 web_contents()->GetController().Reload(false); 871 web_contents()->GetController().Reload(false);
872 } 872 }
873 873
874 void WebViewGuest::FrameNameChanged(RenderFrameHost* render_frame_host, 874 void WebViewGuest::FrameNameChanged(RenderFrameHost* render_frame_host,
875 const std::string& name) { 875 const std::string& name) {
876 if (render_frame_host->GetParent()) 876 if (render_frame_host->GetParent())
877 return; 877 return;
878 878
879 if (name_ == name) 879 if (name_ == name)
880 return; 880 return;
881 881
882 ReportFrameNameChange(name); 882 ReportFrameNameChange(name);
883 } 883 }
884 884
885 void WebViewGuest::ReportFrameNameChange(const std::string& name) { 885 void WebViewGuest::ReportFrameNameChange(const std::string& name) {
886 name_ = name; 886 name_ = name;
887 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 887 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
888 args->SetString(webview::kName, name); 888 args->SetString(webview::kName, name);
889 DispatchEventToView(base::WrapUnique( 889 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
890 new GuestViewEvent(webview::kEventFrameNameChanged, std::move(args)))); 890 webview::kEventFrameNameChanged, std::move(args)));
891 } 891 }
892 892
893 void WebViewGuest::LoadHandlerCalled() { 893 void WebViewGuest::LoadHandlerCalled() {
894 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 894 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
895 DispatchEventToView(base::WrapUnique( 895 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
896 new GuestViewEvent(webview::kEventContentLoad, std::move(args)))); 896 webview::kEventContentLoad, std::move(args)));
897 } 897 }
898 898
899 void WebViewGuest::LoadRedirect(const GURL& old_url, 899 void WebViewGuest::LoadRedirect(const GURL& old_url,
900 const GURL& new_url, 900 const GURL& new_url,
901 bool is_top_level) { 901 bool is_top_level) {
902 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 902 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
903 args->SetBoolean(guest_view::kIsTopLevel, is_top_level); 903 args->SetBoolean(guest_view::kIsTopLevel, is_top_level);
904 args->SetString(webview::kNewURL, new_url.spec()); 904 args->SetString(webview::kNewURL, new_url.spec());
905 args->SetString(webview::kOldURL, old_url.spec()); 905 args->SetString(webview::kOldURL, old_url.spec());
906 DispatchEventToView(base::WrapUnique( 906 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
907 new GuestViewEvent(webview::kEventLoadRedirect, std::move(args)))); 907 webview::kEventLoadRedirect, std::move(args)));
908 } 908 }
909 909
910 void WebViewGuest::PushWebViewStateToIOThread() { 910 void WebViewGuest::PushWebViewStateToIOThread() {
911 const GURL& site_url = web_contents()->GetSiteInstance()->GetSiteURL(); 911 const GURL& site_url = web_contents()->GetSiteInstance()->GetSiteURL();
912 std::string partition_domain; 912 std::string partition_domain;
913 std::string partition_id; 913 std::string partition_id;
914 bool in_memory; 914 bool in_memory;
915 if (!GetGuestPartitionConfigForSite( 915 if (!GetGuestPartitionConfigForSite(
916 site_url, &partition_domain, &partition_id, &in_memory)) { 916 site_url, &partition_domain, &partition_id, &in_memory)) {
917 NOTREACHED(); 917 NOTREACHED();
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 return; 1490 return;
1491 1491
1492 bool was_fullscreen = is_guest_fullscreen_; 1492 bool was_fullscreen = is_guest_fullscreen_;
1493 is_guest_fullscreen_ = is_fullscreen; 1493 is_guest_fullscreen_ = is_fullscreen;
1494 // If the embedder entered fullscreen because of us, it should exit fullscreen 1494 // If the embedder entered fullscreen because of us, it should exit fullscreen
1495 // when we exit fullscreen. 1495 // when we exit fullscreen.
1496 if (was_fullscreen && GuestMadeEmbedderFullscreen()) { 1496 if (was_fullscreen && GuestMadeEmbedderFullscreen()) {
1497 // Dispatch a message so we can call document.webkitCancelFullscreen() 1497 // Dispatch a message so we can call document.webkitCancelFullscreen()
1498 // on the embedder. 1498 // on the embedder.
1499 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 1499 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
1500 DispatchEventToView(base::WrapUnique( 1500 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
1501 new GuestViewEvent(webview::kEventExitFullscreen, std::move(args)))); 1501 webview::kEventExitFullscreen, std::move(args)));
1502 } 1502 }
1503 // Since we changed fullscreen state, sending a Resize message ensures that 1503 // Since we changed fullscreen state, sending a Resize message ensures that
1504 // renderer/ sees the change. 1504 // renderer/ sees the change.
1505 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); 1505 web_contents()->GetRenderViewHost()->GetWidget()->WasResized();
1506 } 1506 }
1507 1507
1508 } // namespace extensions 1508 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698