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

Side by Side Diff: content/browser/intents/intent_injector.cc

Issue 9600036: Move Render(View|Widget)Host and associated classes to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/intents/intent_injector.h" 5 #include "content/browser/intents/intent_injector.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "content/browser/renderer_host/render_view_host_impl.h" 11 #include "content/browser/renderer_host/render_view_host_impl.h"
12 #include "content/browser/tab_contents/tab_contents.h" 12 #include "content/browser/tab_contents/tab_contents.h"
13 #include "content/common/intents_messages.h" 13 #include "content/common/intents_messages.h"
14 #include "content/public/browser/web_intents_dispatcher.h" 14 #include "content/public/browser/web_intents_dispatcher.h"
15 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
16 #include "webkit/glue/web_intent_data.h" 16 #include "webkit/glue/web_intent_data.h"
17 #include "webkit/glue/web_intent_reply_data.h" 17 #include "webkit/glue/web_intent_reply_data.h"
18 18
19 using content::RenderViewHost;
19 using content::WebContents; 20 using content::WebContents;
20 21
21 IntentInjector::IntentInjector(WebContents* web_contents) 22 IntentInjector::IntentInjector(WebContents* web_contents)
22 : content::WebContentsObserver(web_contents), 23 : content::WebContentsObserver(web_contents),
23 intents_dispatcher_(NULL) { 24 intents_dispatcher_(NULL) {
24 DCHECK(web_contents); 25 DCHECK(web_contents);
25 } 26 }
26 27
27 IntentInjector::~IntentInjector() { 28 IntentInjector::~IntentInjector() {
28 } 29 }
(...skipping 26 matching lines...) Expand all
55 } 56 }
56 57
57 void IntentInjector::RenderViewCreated(RenderViewHost* render_view_host) { 58 void IntentInjector::RenderViewCreated(RenderViewHost* render_view_host) {
58 if (source_intent_.get() == NULL || 59 if (source_intent_.get() == NULL ||
59 CommandLine::ForCurrentProcess()->HasSwitch( 60 CommandLine::ForCurrentProcess()->HasSwitch(
60 switches::kDisableWebIntents) || 61 switches::kDisableWebIntents) ||
61 web_contents()->GetRenderViewHost() == NULL) { 62 web_contents()->GetRenderViewHost() == NULL) {
62 return; 63 return;
63 } 64 }
64 65
65 static_cast<RenderViewHostImpl*>(render_view_host)->Send( 66 render_view_host->Send(new IntentsMsg_SetWebIntentData(
66 new IntentsMsg_SetWebIntentData( 67 render_view_host->GetRoutingID(), *(source_intent_.get())));
67 render_view_host->GetRoutingID(), *(source_intent_.get())));
68 } 68 }
69 69
70 bool IntentInjector::OnMessageReceived(const IPC::Message& message) { 70 bool IntentInjector::OnMessageReceived(const IPC::Message& message) {
71 bool handled = true; 71 bool handled = true;
72 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message) 72 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message)
73 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply); 73 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply);
74 IPC_MESSAGE_UNHANDLED(handled = false) 74 IPC_MESSAGE_UNHANDLED(handled = false)
75 IPC_END_MESSAGE_MAP() 75 IPC_END_MESSAGE_MAP()
76 return handled; 76 return handled;
77 } 77 }
78 78
79 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type, 79 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type,
80 const string16& data) { 80 const string16& data) {
81 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents)) 81 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents))
82 NOTREACHED(); 82 NOTREACHED();
83 83
84 if (intents_dispatcher_) { 84 if (intents_dispatcher_) {
85 // Ensure we only call SendReplyMessage once. 85 // Ensure we only call SendReplyMessage once.
86 content::WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_; 86 content::WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_;
87 intents_dispatcher_ = NULL; 87 intents_dispatcher_ = NULL;
88 intents_dispatcher->SendReplyMessage(reply_type, data); 88 intents_dispatcher->SendReplyMessage(reply_type, data);
89 } 89 }
90 } 90 }
OLDNEW
« no previous file with comments | « content/browser/intents/intent_injector.h ('k') | content/browser/renderer_host/backing_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698