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

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: Fix Android + Review comments 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 double zoom_factor = GetEmbedderZoomFactor(); 511 double zoom_factor = GetEmbedderZoomFactor();
512 return lround(logical_pixels * zoom_factor); 512 return lround(logical_pixels * zoom_factor);
513 } 513 }
514 514
515 double GuestViewBase::PhysicalPixelsToLogicalPixels(int physical_pixels) { 515 double GuestViewBase::PhysicalPixelsToLogicalPixels(int physical_pixels) {
516 DCHECK(physical_pixels >= 0); 516 DCHECK(physical_pixels >= 0);
517 double zoom_factor = GetEmbedderZoomFactor(); 517 double zoom_factor = GetEmbedderZoomFactor();
518 return physical_pixels / zoom_factor; 518 return physical_pixels / zoom_factor;
519 } 519 }
520 520
521 void GuestViewBase::DidStopLoading(content::RenderViewHost* render_view_host) { 521 void GuestViewBase::DidStopLoading() {
522 content::RenderViewHost* rvh = web_contents()->GetRenderViewHost();
523
522 if (IsPreferredSizeModeEnabled()) { 524 if (IsPreferredSizeModeEnabled()) {
Fady Samuel 2015/03/14 04:25:02 nit: Could you please get rid of these unnecessary
Fabrice (no longer in Chrome) 2015/03/16 11:56:13 Done.
523 render_view_host->EnablePreferredSizeMode(); 525 rvh->EnablePreferredSizeMode();
524 } 526 }
525 if (!IsDragAndDropEnabled()) { 527 if (!IsDragAndDropEnabled()) {
526 const char script[] = "window.addEventListener('dragstart', function() { " 528 const char script[] =
527 " window.event.preventDefault(); " 529 "window.addEventListener('dragstart', function() { "
528 "});"; 530 " window.event.preventDefault(); "
529 render_view_host->GetMainFrame()->ExecuteJavaScript( 531 "});";
530 base::ASCIIToUTF16(script)); 532 rvh->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16(script));
531 } 533 }
532 DidStopLoading(); 534 GuestViewDidStopLoading();
533 } 535 }
534 536
535 void GuestViewBase::RenderViewReady() { 537 void GuestViewBase::RenderViewReady() {
536 GuestReady(); 538 GuestReady();
537 } 539 }
538 540
539 void GuestViewBase::WebContentsDestroyed() { 541 void GuestViewBase::WebContentsDestroyed() {
540 // Let the derived class know that its WebContents is in the process of 542 // Let the derived class know that its WebContents is in the process of
541 // being destroyed. web_contents() is still valid at this point. 543 // being destroyed. web_contents() is still valid at this point.
542 // TODO(fsamuel): This allows for reentrant code into WebContents during 544 // TODO(fsamuel): This allows for reentrant code into WebContents during
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 void GuestViewBase::RegisterGuestViewTypes() { 821 void GuestViewBase::RegisterGuestViewTypes() {
820 AppViewGuest::Register(); 822 AppViewGuest::Register();
821 ExtensionOptionsGuest::Register(); 823 ExtensionOptionsGuest::Register();
822 ExtensionViewGuest::Register(); 824 ExtensionViewGuest::Register();
823 MimeHandlerViewGuest::Register(); 825 MimeHandlerViewGuest::Register();
824 SurfaceWorkerGuest::Register(); 826 SurfaceWorkerGuest::Register();
825 WebViewGuest::Register(); 827 WebViewGuest::Register();
826 } 828 }
827 829
828 } // namespace extensions 830 } // 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