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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // This observer ensures that the GuestViewBase destroys itself when its | 58 // This observer ensures that the GuestViewBase destroys itself when its |
59 // embedder goes away. | 59 // embedder goes away. |
60 class GuestViewBase::EmbedderLifetimeObserver : public WebContentsObserver { | 60 class GuestViewBase::EmbedderLifetimeObserver : public WebContentsObserver { |
61 public: | 61 public: |
62 EmbedderLifetimeObserver(GuestViewBase* guest, | 62 EmbedderLifetimeObserver(GuestViewBase* guest, |
63 content::WebContents* embedder_web_contents) | 63 content::WebContents* embedder_web_contents) |
64 : WebContentsObserver(embedder_web_contents), | 64 : WebContentsObserver(embedder_web_contents), |
65 destroyed_(false), | 65 destroyed_(false), |
66 guest_(guest) {} | 66 guest_(guest) {} |
67 | 67 |
68 virtual ~EmbedderLifetimeObserver() {} | 68 ~EmbedderLifetimeObserver() override {} |
69 | 69 |
70 // WebContentsObserver implementation. | 70 // WebContentsObserver implementation. |
71 virtual void WebContentsDestroyed() override { | 71 void WebContentsDestroyed() override { |
72 // If the embedder is destroyed then destroy the guest. | 72 // If the embedder is destroyed then destroy the guest. |
73 Destroy(); | 73 Destroy(); |
74 } | 74 } |
75 | 75 |
76 virtual void AboutToNavigateRenderView( | 76 void AboutToNavigateRenderView( |
77 content::RenderViewHost* render_view_host) override { | 77 content::RenderViewHost* render_view_host) override { |
78 // If the embedder navigates then destroy the guest. | 78 // If the embedder navigates then destroy the guest. |
79 Destroy(); | 79 Destroy(); |
80 } | 80 } |
81 | 81 |
82 virtual void RenderProcessGone(base::TerminationStatus status) override { | 82 void RenderProcessGone(base::TerminationStatus status) override { |
83 // If the embedder crashes, then destroy the guest. | 83 // If the embedder crashes, then destroy the guest. |
84 Destroy(); | 84 Destroy(); |
85 } | 85 } |
86 | 86 |
87 private: | 87 private: |
88 bool destroyed_; | 88 bool destroyed_; |
89 GuestViewBase* guest_; | 89 GuestViewBase* guest_; |
90 | 90 |
91 void Destroy() { | 91 void Destroy() { |
92 if (destroyed_) | 92 if (destroyed_) |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 493 |
494 // static | 494 // static |
495 void GuestViewBase::RegisterGuestViewTypes() { | 495 void GuestViewBase::RegisterGuestViewTypes() { |
496 AppViewGuest::Register(); | 496 AppViewGuest::Register(); |
497 ExtensionOptionsGuest::Register(); | 497 ExtensionOptionsGuest::Register(); |
498 MimeHandlerViewGuest::Register(); | 498 MimeHandlerViewGuest::Register(); |
499 WebViewGuest::Register(); | 499 WebViewGuest::Register(); |
500 } | 500 } |
501 | 501 |
502 } // namespace extensions | 502 } // namespace extensions |
OLD | NEW |