| 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/renderer/web_intents_host.h" | 5 #include "content/renderer/web_intents_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "content/common/intents_messages.h" | 10 #include "content/common/intents_messages.h" |
| 11 #include "content/renderer/render_view_impl.h" | 11 #include "content/renderer/render_view_impl.h" |
| 12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentRequest.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentRequest.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" |
| 20 #include "v8/include/v8.h" | 20 #include "v8/include/v8.h" |
| 21 #include "webkit/glue/cpp_bound_class.h" | 21 #include "webkit/glue/cpp_bound_class.h" |
| 22 | 22 |
| 23 using WebKit::WebBindings; | 23 using WebKit::WebBindings; |
| 24 using WebKit::WebBlob; | 24 using WebKit::WebBlob; |
| 25 using WebKit::WebCString; | 25 using WebKit::WebCString; |
| 26 using WebKit::WebFrame; | 26 using WebKit::WebFrame; |
| 27 using WebKit::WebIntentRequest; | 27 using WebKit::WebIntentRequest; |
| 28 using WebKit::WebString; | 28 using WebKit::WebString; |
| 29 using WebKit::WebSerializedScriptValue; | 29 using WebKit::WebSerializedScriptValue; |
| 30 using webkit_glue::CppArgumentList; |
| 31 using webkit_glue::CppBoundClass; |
| 32 using webkit_glue::CppVariant; |
| 30 | 33 |
| 31 // This class encapsulates the API the Intent object will expose to Javascript. | 34 // This class encapsulates the API the Intent object will expose to Javascript. |
| 32 // It is made available to the Javascript runtime in the service page using | 35 // It is made available to the Javascript runtime in the service page using |
| 33 // NPAPI methods as with plugin/Javascript interaction objects and other | 36 // NPAPI methods as with plugin/Javascript interaction objects and other |
| 34 // browser-provided Javascript API objects on |window|. | 37 // browser-provided Javascript API objects on |window|. |
| 35 class WebIntentsHost::BoundDeliveredIntent : public CppBoundClass { | 38 class WebIntentsHost::BoundDeliveredIntent : public CppBoundClass { |
| 36 public: | 39 public: |
| 37 BoundDeliveredIntent(const webkit_glue::WebIntentData& intent, | 40 BoundDeliveredIntent(const webkit_glue::WebIntentData& intent, |
| 38 WebIntentsHost* parent, | 41 WebIntentsHost* parent, |
| 39 WebFrame* frame) { | 42 WebFrame* frame) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // documented. | 234 // documented. |
| 232 void WebIntentsHost::DidClearWindowObject(WebFrame* frame) { | 235 void WebIntentsHost::DidClearWindowObject(WebFrame* frame) { |
| 233 if (intent_.get() == NULL || frame->top() != frame) | 236 if (intent_.get() == NULL || frame->top() != frame) |
| 234 return; | 237 return; |
| 235 if (!delivered_intent_.get()) { | 238 if (!delivered_intent_.get()) { |
| 236 delivered_intent_.reset( | 239 delivered_intent_.reset( |
| 237 new BoundDeliveredIntent(*(intent_.get()), this, frame)); | 240 new BoundDeliveredIntent(*(intent_.get()), this, frame)); |
| 238 } | 241 } |
| 239 delivered_intent_->BindToJavascript(frame, "webkitIntent"); | 242 delivered_intent_->BindToJavascript(frame, "webkitIntent"); |
| 240 } | 243 } |
| OLD | NEW |