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/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 "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 " window.event.preventDefault(); " | 412 " window.event.preventDefault(); " |
413 "});"; | 413 "});"; |
414 render_view_host->GetMainFrame()->ExecuteJavaScript( | 414 render_view_host->GetMainFrame()->ExecuteJavaScript( |
415 base::ASCIIToUTF16(script)); | 415 base::ASCIIToUTF16(script)); |
416 } | 416 } |
417 DidStopLoading(); | 417 DidStopLoading(); |
418 } | 418 } |
419 | 419 |
420 void GuestViewBase::RenderViewReady() { | 420 void GuestViewBase::RenderViewReady() { |
421 GuestReady(); | 421 GuestReady(); |
422 content::RenderViewHost* rvh = web_contents()->GetRenderViewHost(); | |
423 if (auto_size_enabled_) { | |
424 rvh->EnableAutoResize(min_auto_size_, max_auto_size_); | |
425 } else { | |
426 rvh->DisableAutoResize(element_size_); | |
427 } | |
428 } | 422 } |
429 | 423 |
430 void GuestViewBase::WebContentsDestroyed() { | 424 void GuestViewBase::WebContentsDestroyed() { |
431 // Let the derived class know that its WebContents is in the process of | 425 // Let the derived class know that its WebContents is in the process of |
432 // being destroyed. web_contents() is still valid at this point. | 426 // being destroyed. web_contents() is still valid at this point. |
433 // TODO(fsamuel): This allows for reentrant code into WebContents during | 427 // TODO(fsamuel): This allows for reentrant code into WebContents during |
434 // destruction. This could potentially lead to bugs. Perhaps we should get rid | 428 // destruction. This could potentially lead to bugs. Perhaps we should get rid |
435 // of this? | 429 // of this? |
436 GuestDestroyed(); | 430 GuestDestroyed(); |
437 | 431 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 523 |
530 // static | 524 // static |
531 void GuestViewBase::RegisterGuestViewTypes() { | 525 void GuestViewBase::RegisterGuestViewTypes() { |
532 AppViewGuest::Register(); | 526 AppViewGuest::Register(); |
533 ExtensionOptionsGuest::Register(); | 527 ExtensionOptionsGuest::Register(); |
534 MimeHandlerViewGuest::Register(); | 528 MimeHandlerViewGuest::Register(); |
535 WebViewGuest::Register(); | 529 WebViewGuest::Register(); |
536 } | 530 } |
537 | 531 |
538 } // namespace extensions | 532 } // namespace extensions |
OLD | NEW |