Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc

Issue 892923002: Move GuestView IPCs into their own messages file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/guest_view/guest_view_message_filter.cc ('k') | extensions/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/guest_view_constants.h" 24 #include "extensions/common/guest_view/guest_view_constants.h"
25 #include "extensions/common/guest_view/guest_view_messages.h"
25 #include "extensions/strings/grit/extensions_strings.h" 26 #include "extensions/strings/grit/extensions_strings.h"
26 #include "ipc/ipc_message_macros.h" 27 #include "ipc/ipc_message_macros.h"
27 #include "net/base/url_util.h" 28 #include "net/base/url_util.h"
28 29
29 using content::WebContents; 30 using content::WebContents;
30 31
31 namespace extensions { 32 namespace extensions {
32 33
33 StreamContainer::StreamContainer(scoped_ptr<content::StreamInfo> stream, 34 StreamContainer::StreamContainer(scoped_ptr<content::StreamInfo> stream,
34 int tab_id, 35 int tab_id,
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (!attached()) 209 if (!attached())
209 return false; 210 return false;
210 211
211 embedder_web_contents()->SaveFrame(stream_->stream_info()->original_url, 212 embedder_web_contents()->SaveFrame(stream_->stream_info()->original_url,
212 referrer); 213 referrer);
213 return true; 214 return true;
214 } 215 }
215 216
216 void MimeHandlerViewGuest::DocumentOnLoadCompletedInMainFrame() { 217 void MimeHandlerViewGuest::DocumentOnLoadCompletedInMainFrame() {
217 embedder_web_contents()->Send( 218 embedder_web_contents()->Send(
218 new ExtensionMsg_MimeHandlerViewGuestOnLoadCompleted( 219 new GuestViewMsg_MimeHandlerViewGuestOnLoadCompleted(
219 element_instance_id())); 220 element_instance_id()));
220 } 221 }
221 222
222 bool MimeHandlerViewGuest::OnMessageReceived(const IPC::Message& message) { 223 bool MimeHandlerViewGuest::OnMessageReceived(const IPC::Message& message) {
223 bool handled = true; 224 bool handled = true;
224 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewGuest, message) 225 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewGuest, message)
225 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) 226 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
226 IPC_MESSAGE_UNHANDLED(handled = false) 227 IPC_MESSAGE_UNHANDLED(handled = false)
227 IPC_END_MESSAGE_MAP() 228 IPC_END_MESSAGE_MAP()
228 return handled; 229 return handled;
229 } 230 }
230 231
231 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const { 232 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const {
232 if (!stream_) 233 if (!stream_)
233 return base::WeakPtr<StreamContainer>(); 234 return base::WeakPtr<StreamContainer>();
234 return stream_->GetWeakPtr(); 235 return stream_->GetWeakPtr();
235 } 236 }
236 237
237 void MimeHandlerViewGuest::OnRequest( 238 void MimeHandlerViewGuest::OnRequest(
238 const ExtensionHostMsg_Request_Params& params) { 239 const ExtensionHostMsg_Request_Params& params) {
239 if (extension_function_dispatcher_) { 240 if (extension_function_dispatcher_) {
240 extension_function_dispatcher_->Dispatch( 241 extension_function_dispatcher_->Dispatch(
241 params, web_contents()->GetRenderViewHost()); 242 params, web_contents()->GetRenderViewHost());
242 } 243 }
243 } 244 }
244 245
245 } // namespace extensions 246 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/guest_view_message_filter.cc ('k') | extensions/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698