OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/intents_dispatcher.h" | 5 #include "content/renderer/intents_dispatcher.h" |
6 | 6 |
7 #include "content/common/intents_messages.h" | 7 #include "content/common/intents_messages.h" |
8 #include "content/renderer/render_view.h" | 8 #include "content/renderer/render_view_impl.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa
lue.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa
lue.h" |
14 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
15 #include "webkit/glue/cpp_bound_class.h" | 15 #include "webkit/glue/cpp_bound_class.h" |
16 | 16 |
17 using WebKit::WebCString; | 17 using WebKit::WebCString; |
18 using WebKit::WebString; | 18 using WebKit::WebString; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 private: | 112 private: |
113 // Intent data suitable for surfacing to Javascript callers. | 113 // Intent data suitable for surfacing to Javascript callers. |
114 WebCString action_; | 114 WebCString action_; |
115 WebCString type_; | 115 WebCString type_; |
116 scoped_ptr<CppVariant> data_val_; | 116 scoped_ptr<CppVariant> data_val_; |
117 | 117 |
118 // The dispatcher object, for forwarding postResult/postFailure calls. | 118 // The dispatcher object, for forwarding postResult/postFailure calls. |
119 IntentsDispatcher* parent_; | 119 IntentsDispatcher* parent_; |
120 }; | 120 }; |
121 | 121 |
122 IntentsDispatcher::IntentsDispatcher(RenderView* render_view) | 122 IntentsDispatcher::IntentsDispatcher(RenderViewImpl* render_view) |
123 : content::RenderViewObserver(render_view), | 123 : content::RenderViewObserver(render_view), |
124 intent_id_(0) { | 124 intent_id_(0) { |
125 } | 125 } |
126 | 126 |
127 IntentsDispatcher::~IntentsDispatcher() {} | 127 IntentsDispatcher::~IntentsDispatcher() {} |
128 | 128 |
129 bool IntentsDispatcher::OnMessageReceived(const IPC::Message& message) { | 129 bool IntentsDispatcher::OnMessageReceived(const IPC::Message& message) { |
130 bool handled = true; | 130 bool handled = true; |
131 IPC_BEGIN_MESSAGE_MAP(IntentsDispatcher, message) | 131 IPC_BEGIN_MESSAGE_MAP(IntentsDispatcher, message) |
132 IPC_MESSAGE_HANDLER(IntentsMsg_SetWebIntentData, OnSetIntent) | 132 IPC_MESSAGE_HANDLER(IntentsMsg_SetWebIntentData, OnSetIntent) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // sub-frames. TODO(gbillock): This policy needs to be fine-tuned and | 171 // sub-frames. TODO(gbillock): This policy needs to be fine-tuned and |
172 // documented. | 172 // documented. |
173 void IntentsDispatcher::DidClearWindowObject(WebKit::WebFrame* frame) { | 173 void IntentsDispatcher::DidClearWindowObject(WebKit::WebFrame* frame) { |
174 if (intent_.get() == NULL || frame->top() != frame) | 174 if (intent_.get() == NULL || frame->top() != frame) |
175 return; | 175 return; |
176 | 176 |
177 delivered_intent_.reset(new BoundDeliveredIntent( | 177 delivered_intent_.reset(new BoundDeliveredIntent( |
178 intent_->action, intent_->type, intent_->data, this, frame)); | 178 intent_->action, intent_->type, intent_->data, this, frame)); |
179 delivered_intent_->BindToJavascript(frame, "intent"); | 179 delivered_intent_->BindToJavascript(frame, "intent"); |
180 } | 180 } |
OLD | NEW |