OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/dom_distiller/content/renderer/distiller_native_javascript.
h" | 5 #include "components/dom_distiller/content/renderer/distiller_native_javascript.
h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 v8::Local<v8::Object> distiller_obj = | 39 v8::Local<v8::Object> distiller_obj = |
40 GetOrCreateDistillerObject(isolate, context->Global()); | 40 GetOrCreateDistillerObject(isolate, context->Global()); |
41 | 41 |
42 EnsureServiceConnected(); | 42 EnsureServiceConnected(); |
43 | 43 |
44 // Many functions can simply call the Mojo interface directly and have no | 44 // Many functions can simply call the Mojo interface directly and have no |
45 // wrapper function for binding. Note that calling distiller_js_service.get() | 45 // wrapper function for binding. Note that calling distiller_js_service.get() |
46 // does not transfer ownership of the interface. | 46 // does not transfer ownership of the interface. |
47 BindFunctionToObject( | 47 BindFunctionToObject( |
48 distiller_obj, "sendFeedback", | |
49 base::Bind( | |
50 &mojom::DistillerJavaScriptService::HandleDistillerFeedbackCall, | |
51 base::Unretained(distiller_js_service_.get()))); | |
52 | |
53 BindFunctionToObject( | |
54 distiller_obj, "closePanel", | 48 distiller_obj, "closePanel", |
55 base::Bind( | 49 base::Bind( |
56 &mojom::DistillerJavaScriptService::HandleDistillerClosePanelCall, | 50 &mojom::DistillerJavaScriptService::HandleDistillerClosePanelCall, |
57 base::Unretained(distiller_js_service_.get()))); | 51 base::Unretained(distiller_js_service_.get()))); |
58 | 52 |
59 BindFunctionToObject( | 53 BindFunctionToObject( |
60 distiller_obj, "openSettings", | 54 distiller_obj, "openSettings", |
61 base::Bind( | 55 base::Bind( |
62 &mojom::DistillerJavaScriptService::HandleDistillerOpenSettingsCall, | 56 &mojom::DistillerJavaScriptService::HandleDistillerOpenSettingsCall, |
63 base::Unretained(distiller_js_service_.get()))); | 57 base::Unretained(distiller_js_service_.get()))); |
(...skipping 26 matching lines...) Expand all Loading... |
90 if (distiller_value.IsEmpty() || !distiller_value->IsObject()) { | 84 if (distiller_value.IsEmpty() || !distiller_value->IsObject()) { |
91 distiller_obj = v8::Object::New(isolate); | 85 distiller_obj = v8::Object::New(isolate); |
92 global->Set(gin::StringToSymbol(isolate, "distiller"), distiller_obj); | 86 global->Set(gin::StringToSymbol(isolate, "distiller"), distiller_obj); |
93 } else { | 87 } else { |
94 distiller_obj = v8::Local<v8::Object>::Cast(distiller_value); | 88 distiller_obj = v8::Local<v8::Object>::Cast(distiller_value); |
95 } | 89 } |
96 return distiller_obj; | 90 return distiller_obj; |
97 } | 91 } |
98 | 92 |
99 } // namespace dom_distiller | 93 } // namespace dom_distiller |
OLD | NEW |