OLD | NEW |
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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "content/browser/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 void IntentInjector::RenderViewCreated(RenderViewHost* render_view_host) { | 49 void IntentInjector::RenderViewCreated(RenderViewHost* render_view_host) { |
50 if (source_intent_.get() == NULL || | 50 if (source_intent_.get() == NULL || |
51 CommandLine::ForCurrentProcess()->HasSwitch( | 51 CommandLine::ForCurrentProcess()->HasSwitch( |
52 switches::kDisableWebIntents) || | 52 switches::kDisableWebIntents) || |
53 web_contents()->GetRenderViewHost() == NULL) { | 53 web_contents()->GetRenderViewHost() == NULL) { |
54 return; | 54 return; |
55 } | 55 } |
56 | 56 |
57 render_view_host->Send(new IntentsMsg_SetWebIntentData( | 57 static_cast<RenderViewHostImpl*>(render_view_host)->Send( |
58 render_view_host->routing_id(), *(source_intent_.get()))); | 58 new IntentsMsg_SetWebIntentData( |
| 59 render_view_host->GetRoutingID(), *(source_intent_.get()))); |
59 } | 60 } |
60 | 61 |
61 bool IntentInjector::OnMessageReceived(const IPC::Message& message) { | 62 bool IntentInjector::OnMessageReceived(const IPC::Message& message) { |
62 bool handled = true; | 63 bool handled = true; |
63 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message) | 64 IPC_BEGIN_MESSAGE_MAP(IntentInjector, message) |
64 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply); | 65 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentReply, OnReply); |
65 IPC_MESSAGE_UNHANDLED(handled = false) | 66 IPC_MESSAGE_UNHANDLED(handled = false) |
66 IPC_END_MESSAGE_MAP() | 67 IPC_END_MESSAGE_MAP() |
67 return handled; | 68 return handled; |
68 } | 69 } |
69 | 70 |
70 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type, | 71 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type, |
71 const string16& data) { | 72 const string16& data) { |
72 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents)) | 73 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents)) |
73 NOTREACHED(); | 74 NOTREACHED(); |
74 | 75 |
75 if (intents_dispatcher_) { | 76 if (intents_dispatcher_) { |
76 // Ensure we only call SendReplyMessage once. | 77 // Ensure we only call SendReplyMessage once. |
77 content::WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_; | 78 content::WebIntentsDispatcher* intents_dispatcher = intents_dispatcher_; |
78 intents_dispatcher_ = NULL; | 79 intents_dispatcher_ = NULL; |
79 intents_dispatcher->SendReplyMessage(reply_type, data); | 80 intents_dispatcher->SendReplyMessage(reply_type, data); |
80 } | 81 } |
81 } | 82 } |
OLD | NEW |