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/renderer/guest_view/guest_view_container.h" | 5 #include "extensions/renderer/guest_view/guest_view_container.h" |
6 | 6 |
7 #include "content/public/renderer/render_frame.h" | 7 #include "content/public/renderer/render_frame.h" |
8 #include "content/public/renderer/render_frame_observer.h" | 8 #include "content/public/renderer/render_frame_observer.h" |
9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
10 #include "extensions/common/extension_messages.h" | |
11 #include "extensions/common/guest_view/guest_view_constants.h" | 10 #include "extensions/common/guest_view/guest_view_constants.h" |
| 11 #include "extensions/common/guest_view/guest_view_messages.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 class GuestViewContainer::RenderFrameLifetimeObserver | 15 class GuestViewContainer::RenderFrameLifetimeObserver |
16 : public content::RenderFrameObserver { | 16 : public content::RenderFrameObserver { |
17 public: | 17 public: |
18 RenderFrameLifetimeObserver(GuestViewContainer* container, | 18 RenderFrameLifetimeObserver(GuestViewContainer* container, |
19 content::RenderFrame* render_frame); | 19 content::RenderFrame* render_frame); |
20 | 20 |
21 // content::RenderFrameObserver overrides. | 21 // content::RenderFrameObserver overrides. |
(...skipping 21 matching lines...) Expand all Loading... |
43 render_frame_(render_frame) { | 43 render_frame_(render_frame) { |
44 render_frame_lifetime_observer_.reset( | 44 render_frame_lifetime_observer_.reset( |
45 new RenderFrameLifetimeObserver(this, render_frame_)); | 45 new RenderFrameLifetimeObserver(this, render_frame_)); |
46 } | 46 } |
47 | 47 |
48 GuestViewContainer::~GuestViewContainer() {} | 48 GuestViewContainer::~GuestViewContainer() {} |
49 | 49 |
50 // static. | 50 // static. |
51 bool GuestViewContainer::HandlesMessage(const IPC::Message& msg) { | 51 bool GuestViewContainer::HandlesMessage(const IPC::Message& msg) { |
52 switch (msg.type()) { | 52 switch (msg.type()) { |
53 case ExtensionMsg_CreateMimeHandlerViewGuestACK::ID: | 53 case GuestViewMsg_CreateMimeHandlerViewGuestACK::ID: |
54 case ExtensionMsg_GuestAttached::ID: | 54 case GuestViewMsg_GuestAttached::ID: |
55 case ExtensionMsg_GuestDetached::ID: | 55 case GuestViewMsg_GuestDetached::ID: |
56 case ExtensionMsg_MimeHandlerViewGuestOnLoadCompleted::ID: | 56 case GuestViewMsg_MimeHandlerViewGuestOnLoadCompleted::ID: |
57 return true; | 57 return true; |
58 default: | 58 default: |
59 return false; | 59 return false; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 void GuestViewContainer::RenderFrameDestroyed() { | 63 void GuestViewContainer::RenderFrameDestroyed() { |
64 OnRenderFrameDestroyed(); | 64 OnRenderFrameDestroyed(); |
65 render_frame_ = nullptr; | 65 render_frame_ = nullptr; |
66 } | 66 } |
67 | 67 |
68 void GuestViewContainer::SetElementInstanceID(int element_instance_id) { | 68 void GuestViewContainer::SetElementInstanceID(int element_instance_id) { |
69 DCHECK_EQ(element_instance_id_, guestview::kInstanceIDNone); | 69 DCHECK_EQ(element_instance_id_, guestview::kInstanceIDNone); |
70 element_instance_id_ = element_instance_id; | 70 element_instance_id_ = element_instance_id; |
71 } | 71 } |
72 | 72 |
73 } // namespace extensions | 73 } // namespace extensions |
OLD | NEW |