| 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 "extensions/renderer/app_window_custom_bindings.h" | 5 #include "extensions/renderer/app_window_custom_bindings.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/public/child/v8_value_converter.h" | 8 #include "content/public/child/v8_value_converter.h" |
| 9 #include "content/public/renderer/render_frame.h" | 9 #include "content/public/renderer/render_frame.h" |
| 10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
| 11 #include "content/public/renderer/render_view.h" | 11 #include "content/public/renderer/render_view.h" |
| 12 #include "extensions/common/extension_messages.h" | 12 #include "extensions/common/extension_messages.h" |
| 13 #include "extensions/common/switches.h" | 13 #include "extensions/common/switches.h" |
| 14 #include "extensions/renderer/script_context.h" | 14 #include "extensions/renderer/script_context.h" |
| 15 #include "grit/extensions_renderer_resources.h" | 15 #include "grit/extensions_renderer_resources.h" |
| 16 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 16 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 17 #include "third_party/WebKit/public/web/WebView.h" | 17 #include "third_party/WebKit/public/web/WebView.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "v8/include/v8.h" | 19 #include "v8/include/v8.h" |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 | 22 |
| 23 AppWindowCustomBindings::AppWindowCustomBindings(ScriptContext* context) | 23 AppWindowCustomBindings::AppWindowCustomBindings(ScriptContext* context) |
| 24 : ObjectBackedNativeHandler(context) { | 24 : ObjectBackedNativeHandler(context) { |
| 25 RouteFunction("GetFrame", base::Bind(&AppWindowCustomBindings::GetFrame, | 25 // The input.ime API also creates an app window (for the ime window), and so |
| 26 base::Unretained(this))); | 26 // uses these natives. |
| 27 RouteFunction("GetFrame", |
| 28 std::vector<std::string>({"app.window", "input.ime"}), |
| 29 base::Bind(&AppWindowCustomBindings::GetFrame, |
| 30 base::Unretained(this))); |
| 27 | 31 |
| 28 RouteFunction("GetWindowControlsHtmlTemplate", | 32 RouteFunction("GetWindowControlsHtmlTemplate", |
| 29 base::Bind(&AppWindowCustomBindings::GetWindowControlsHtmlTemplate, | 33 base::Bind(&AppWindowCustomBindings::GetWindowControlsHtmlTemplate, |
| 30 base::Unretained(this))); | 34 base::Unretained(this))); |
| 31 } | 35 } |
| 32 | 36 |
| 33 void AppWindowCustomBindings::GetFrame( | 37 void AppWindowCustomBindings::GetFrame( |
| 34 const v8::FunctionCallbackInfo<v8::Value>& args) { | 38 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 35 // TODO(jeremya): convert this to IDL nocompile to get validation, and turn | 39 // TODO(jeremya): convert this to IDL nocompile to get validation, and turn |
| 36 // these argument checks into CHECK(). | 40 // these argument checks into CHECK(). |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 .GetRawDataResource(IDR_WINDOW_CONTROLS_TEMPLATE_HTML) | 77 .GetRawDataResource(IDR_WINDOW_CONTROLS_TEMPLATE_HTML) |
| 74 .as_string()); | 78 .as_string()); |
| 75 std::unique_ptr<content::V8ValueConverter> converter( | 79 std::unique_ptr<content::V8ValueConverter> converter( |
| 76 content::V8ValueConverter::create()); | 80 content::V8ValueConverter::create()); |
| 77 result = converter->ToV8Value(&value, context()->v8_context()); | 81 result = converter->ToV8Value(&value, context()->v8_context()); |
| 78 } | 82 } |
| 79 args.GetReturnValue().Set(result); | 83 args.GetReturnValue().Set(result); |
| 80 } | 84 } |
| 81 | 85 |
| 82 } // namespace extensions | 86 } // namespace extensions |
| OLD | NEW |