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

Side by Side Diff: extensions/browser/guest_view/guest_view_base.cc

Issue 1008913002: Remove RenderViewHost parameter from WebContentsObserver::Did{Start|Stop}Loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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/guest_view_base.h" 5 #include "extensions/browser/guest_view/guest_view_base.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/ui/zoom/page_zoom.h" 9 #include "components/ui/zoom/page_zoom.h"
10 #include "components/ui/zoom/zoom_controller.h" 10 #include "components/ui/zoom/zoom_controller.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 double zoom_factor = GetEmbedderZoomFactor(); 538 double zoom_factor = GetEmbedderZoomFactor();
539 return lround(logical_pixels * zoom_factor); 539 return lround(logical_pixels * zoom_factor);
540 } 540 }
541 541
542 double GuestViewBase::PhysicalPixelsToLogicalPixels(int physical_pixels) { 542 double GuestViewBase::PhysicalPixelsToLogicalPixels(int physical_pixels) {
543 DCHECK(physical_pixels >= 0); 543 DCHECK(physical_pixels >= 0);
544 double zoom_factor = GetEmbedderZoomFactor(); 544 double zoom_factor = GetEmbedderZoomFactor();
545 return physical_pixels / zoom_factor; 545 return physical_pixels / zoom_factor;
546 } 546 }
547 547
548 void GuestViewBase::DidStopLoading(content::RenderViewHost* render_view_host) { 548 void GuestViewBase::DidStopLoading() {
549 if (IsPreferredSizeModeEnabled()) { 549 content::RenderViewHost* rvh = web_contents()->GetRenderViewHost();
550 render_view_host->EnablePreferredSizeMode(); 550
551 if (IsPreferredSizeModeEnabled())
552 rvh->EnablePreferredSizeMode();
553 if (!IsDragAndDropEnabled()) {
554 const char script[] =
555 "window.addEventListener('dragstart', function() { "
556 " window.event.preventDefault(); "
557 "});";
558 rvh->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16(script));
551 } 559 }
552 if (!IsDragAndDropEnabled()) { 560 GuestViewDidStopLoading();
553 const char script[] = "window.addEventListener('dragstart', function() { "
554 " window.event.preventDefault(); "
555 "});";
556 render_view_host->GetMainFrame()->ExecuteJavaScript(
557 base::ASCIIToUTF16(script));
558 }
559 DidStopLoading();
560 } 561 }
561 562
562 void GuestViewBase::RenderViewReady() { 563 void GuestViewBase::RenderViewReady() {
563 GuestReady(); 564 GuestReady();
564 } 565 }
565 566
566 void GuestViewBase::WebContentsDestroyed() { 567 void GuestViewBase::WebContentsDestroyed() {
567 // Let the derived class know that its WebContents is in the process of 568 // Let the derived class know that its WebContents is in the process of
568 // being destroyed. web_contents() is still valid at this point. 569 // being destroyed. web_contents() is still valid at this point.
569 // TODO(fsamuel): This allows for reentrant code into WebContents during 570 // TODO(fsamuel): This allows for reentrant code into WebContents during
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 void GuestViewBase::RegisterGuestViewTypes() { 847 void GuestViewBase::RegisterGuestViewTypes() {
847 AppViewGuest::Register(); 848 AppViewGuest::Register();
848 ExtensionOptionsGuest::Register(); 849 ExtensionOptionsGuest::Register();
849 ExtensionViewGuest::Register(); 850 ExtensionViewGuest::Register();
850 MimeHandlerViewGuest::Register(); 851 MimeHandlerViewGuest::Register();
851 SurfaceWorkerGuest::Register(); 852 SurfaceWorkerGuest::Register();
852 WebViewGuest::Register(); 853 WebViewGuest::Register();
853 } 854 }
854 855
855 } // namespace extensions 856 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/guest_view_base.h ('k') | extensions/browser/guest_view/web_view/web_view_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698