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/mime_handler_view/mime_handler_view_con
tainer.h" | 5 #include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_con
tainer.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
11 #include "content/public/renderer/render_view.h" | 11 #include "content/public/renderer/render_view.h" |
12 #include "content/public/renderer/v8_value_converter.h" | 12 #include "content/public/renderer/v8_value_converter.h" |
13 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons
tants.h" | 13 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons
tants.h" |
14 #include "extensions/common/extension_messages.h" | 14 #include "extensions/common/extension_messages.h" |
15 #include "extensions/common/guest_view/guest_view_constants.h" | 15 #include "extensions/common/guest_view/guest_view_constants.h" |
| 16 #include "extensions/common/guest_view/guest_view_messages.h" |
16 #include "gin/arguments.h" | 17 #include "gin/arguments.h" |
17 #include "gin/dictionary.h" | 18 #include "gin/dictionary.h" |
18 #include "gin/handle.h" | 19 #include "gin/handle.h" |
19 #include "gin/interceptor.h" | 20 #include "gin/interceptor.h" |
20 #include "gin/object_template_builder.h" | 21 #include "gin/object_template_builder.h" |
21 #include "gin/wrappable.h" | 22 #include "gin/wrappable.h" |
22 #include "third_party/WebKit/public/web/WebDocument.h" | 23 #include "third_party/WebKit/public/web/WebDocument.h" |
23 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 24 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
24 #include "third_party/WebKit/public/web/WebView.h" | 25 #include "third_party/WebKit/public/web/WebView.h" |
25 | 26 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 148 } |
148 | 149 |
149 void MimeHandlerViewContainer::DidReceiveData(const char* data, | 150 void MimeHandlerViewContainer::DidReceiveData(const char* data, |
150 int data_length) { | 151 int data_length) { |
151 view_id_ += std::string(data, data_length); | 152 view_id_ += std::string(data, data_length); |
152 } | 153 } |
153 | 154 |
154 bool MimeHandlerViewContainer::OnMessageReceived(const IPC::Message& message) { | 155 bool MimeHandlerViewContainer::OnMessageReceived(const IPC::Message& message) { |
155 bool handled = true; | 156 bool handled = true; |
156 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewContainer, message) | 157 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewContainer, message) |
157 IPC_MESSAGE_HANDLER(ExtensionMsg_CreateMimeHandlerViewGuestACK, | 158 IPC_MESSAGE_HANDLER(GuestViewMsg_CreateMimeHandlerViewGuestACK, |
158 OnCreateMimeHandlerViewGuestACK) | 159 OnCreateMimeHandlerViewGuestACK) |
159 IPC_MESSAGE_HANDLER(ExtensionMsg_GuestAttached, OnGuestAttached) | 160 IPC_MESSAGE_HANDLER(GuestViewMsg_GuestAttached, OnGuestAttached) |
160 IPC_MESSAGE_HANDLER(ExtensionMsg_MimeHandlerViewGuestOnLoadCompleted, | 161 IPC_MESSAGE_HANDLER(GuestViewMsg_MimeHandlerViewGuestOnLoadCompleted, |
161 OnMimeHandlerViewGuestOnLoadCompleted) | 162 OnMimeHandlerViewGuestOnLoadCompleted) |
162 IPC_MESSAGE_UNHANDLED(handled = false) | 163 IPC_MESSAGE_UNHANDLED(handled = false) |
163 IPC_END_MESSAGE_MAP() | 164 IPC_END_MESSAGE_MAP() |
164 return handled; | 165 return handled; |
165 } | 166 } |
166 | 167 |
167 void MimeHandlerViewContainer::DidResizeElement(const gfx::Size& old_size, | 168 void MimeHandlerViewContainer::DidResizeElement(const gfx::Size& old_size, |
168 const gfx::Size& new_size) { | 169 const gfx::Size& new_size) { |
169 element_size_ = new_size; | 170 element_size_ = new_size; |
170 } | 171 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 293 |
293 void MimeHandlerViewContainer::CreateMimeHandlerViewGuest() { | 294 void MimeHandlerViewContainer::CreateMimeHandlerViewGuest() { |
294 // The loader has completed loading |view_id_| so we can dispose it. | 295 // The loader has completed loading |view_id_| so we can dispose it. |
295 loader_.reset(); | 296 loader_.reset(); |
296 | 297 |
297 DCHECK_NE(element_instance_id(), guestview::kInstanceIDNone); | 298 DCHECK_NE(element_instance_id(), guestview::kInstanceIDNone); |
298 | 299 |
299 if (!render_frame()) | 300 if (!render_frame()) |
300 return; | 301 return; |
301 | 302 |
302 render_frame()->Send(new ExtensionHostMsg_CreateMimeHandlerViewGuest( | 303 render_frame()->Send(new GuestViewHostMsg_CreateMimeHandlerViewGuest( |
303 render_frame()->GetRoutingID(), view_id_, element_instance_id(), | 304 render_frame()->GetRoutingID(), view_id_, element_instance_id(), |
304 element_size_)); | 305 element_size_)); |
305 } | 306 } |
306 | 307 |
307 } // namespace extensions | 308 } // namespace extensions |
OLD | NEW |