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/mime_handler_view/mime_handler_view_gues
t.h" | 5 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/host_zoom_map.h" | 9 #include "content/public/browser/host_zoom_map.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
11 #include "content/public/browser/stream_handle.h" | 11 #include "content/public/browser/stream_handle.h" |
12 #include "content/public/browser/stream_info.h" | 12 #include "content/public/browser/stream_info.h" |
13 #include "content/public/common/service_registry.h" | 13 #include "content/public/common/service_registry.h" |
14 #include "content/public/common/url_constants.h" | 14 #include "content/public/common/url_constants.h" |
15 #include "extensions/browser/api/extensions_api_client.h" | 15 #include "extensions/browser/api/extensions_api_client.h" |
16 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h" | 16 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h" |
17 #include "extensions/browser/extension_registry.h" | 17 #include "extensions/browser/extension_registry.h" |
18 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_stream_ma
nager.h" | 18 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_stream_ma
nager.h" |
19 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons
tants.h" | 19 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons
tants.h" |
20 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t_delegate.h" | 20 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t_delegate.h" |
21 #include "extensions/browser/process_manager.h" | 21 #include "extensions/browser/process_manager.h" |
22 #include "extensions/common/constants.h" | 22 #include "extensions/common/constants.h" |
23 #include "extensions/common/extension_messages.h" | 23 #include "extensions/common/extension_messages.h" |
| 24 #include "extensions/common/guest_view/extensions_guest_view_messages.h" |
24 #include "extensions/common/guest_view/guest_view_constants.h" | 25 #include "extensions/common/guest_view/guest_view_constants.h" |
25 #include "extensions/common/guest_view/guest_view_messages.h" | |
26 #include "extensions/strings/grit/extensions_strings.h" | 26 #include "extensions/strings/grit/extensions_strings.h" |
27 #include "ipc/ipc_message_macros.h" | 27 #include "ipc/ipc_message_macros.h" |
28 #include "net/base/url_util.h" | 28 #include "net/base/url_util.h" |
29 #include "third_party/WebKit/public/web/WebInputEvent.h" | 29 #include "third_party/WebKit/public/web/WebInputEvent.h" |
30 | 30 |
31 using content::WebContents; | 31 using content::WebContents; |
32 | 32 |
33 namespace extensions { | 33 namespace extensions { |
34 | 34 |
35 StreamContainer::StreamContainer(scoped_ptr<content::StreamInfo> stream, | 35 StreamContainer::StreamContainer(scoped_ptr<content::StreamInfo> stream, |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (!attached()) | 239 if (!attached()) |
240 return false; | 240 return false; |
241 | 241 |
242 embedder_web_contents()->SaveFrame(stream_->stream_info()->original_url, | 242 embedder_web_contents()->SaveFrame(stream_->stream_info()->original_url, |
243 referrer); | 243 referrer); |
244 return true; | 244 return true; |
245 } | 245 } |
246 | 246 |
247 void MimeHandlerViewGuest::DocumentOnLoadCompletedInMainFrame() { | 247 void MimeHandlerViewGuest::DocumentOnLoadCompletedInMainFrame() { |
248 embedder_web_contents()->Send( | 248 embedder_web_contents()->Send( |
249 new GuestViewMsg_MimeHandlerViewGuestOnLoadCompleted( | 249 new ExtensionsGuestViewMsg_MimeHandlerViewGuestOnLoadCompleted( |
250 element_instance_id())); | 250 element_instance_id())); |
251 } | 251 } |
252 | 252 |
253 bool MimeHandlerViewGuest::OnMessageReceived(const IPC::Message& message) { | 253 bool MimeHandlerViewGuest::OnMessageReceived(const IPC::Message& message) { |
254 bool handled = true; | 254 bool handled = true; |
255 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewGuest, message) | 255 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewGuest, message) |
256 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) | 256 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) |
257 IPC_MESSAGE_UNHANDLED(handled = false) | 257 IPC_MESSAGE_UNHANDLED(handled = false) |
258 IPC_END_MESSAGE_MAP() | 258 IPC_END_MESSAGE_MAP() |
259 return handled; | 259 return handled; |
260 } | 260 } |
261 | 261 |
262 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const { | 262 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const { |
263 if (!stream_) | 263 if (!stream_) |
264 return base::WeakPtr<StreamContainer>(); | 264 return base::WeakPtr<StreamContainer>(); |
265 return stream_->GetWeakPtr(); | 265 return stream_->GetWeakPtr(); |
266 } | 266 } |
267 | 267 |
268 void MimeHandlerViewGuest::OnRequest( | 268 void MimeHandlerViewGuest::OnRequest( |
269 const ExtensionHostMsg_Request_Params& params) { | 269 const ExtensionHostMsg_Request_Params& params) { |
270 if (extension_function_dispatcher_) { | 270 if (extension_function_dispatcher_) { |
271 extension_function_dispatcher_->Dispatch( | 271 extension_function_dispatcher_->Dispatch( |
272 params, web_contents()->GetRenderViewHost()); | 272 params, web_contents()->GetRenderViewHost()); |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 } // namespace extensions | 276 } // namespace extensions |
OLD | NEW |