Chromium Code Reviews| 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 RouteFunction("GetFrame", |
| 26 base::Unretained(this))); | 26 std::vector<std::string>({"app.window", "input.ime"}), |
|
asargent_no_longer_on_chrome
2016/05/06 17:09:04
why is "input.ime" here in app_window_custom_bindi
Devlin
2016/05/06 22:13:47
Done.
| |
| 27 base::Bind(&AppWindowCustomBindings::GetFrame, | |
| 28 base::Unretained(this))); | |
| 27 | 29 |
| 28 RouteFunction("GetWindowControlsHtmlTemplate", | 30 RouteFunction("GetWindowControlsHtmlTemplate", |
| 29 base::Bind(&AppWindowCustomBindings::GetWindowControlsHtmlTemplate, | 31 base::Bind(&AppWindowCustomBindings::GetWindowControlsHtmlTemplate, |
| 30 base::Unretained(this))); | 32 base::Unretained(this))); |
| 31 } | 33 } |
| 32 | 34 |
| 33 void AppWindowCustomBindings::GetFrame( | 35 void AppWindowCustomBindings::GetFrame( |
| 34 const v8::FunctionCallbackInfo<v8::Value>& args) { | 36 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 35 // TODO(jeremya): convert this to IDL nocompile to get validation, and turn | 37 // TODO(jeremya): convert this to IDL nocompile to get validation, and turn |
| 36 // these argument checks into CHECK(). | 38 // 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) | 75 .GetRawDataResource(IDR_WINDOW_CONTROLS_TEMPLATE_HTML) |
| 74 .as_string()); | 76 .as_string()); |
| 75 std::unique_ptr<content::V8ValueConverter> converter( | 77 std::unique_ptr<content::V8ValueConverter> converter( |
| 76 content::V8ValueConverter::create()); | 78 content::V8ValueConverter::create()); |
| 77 result = converter->ToV8Value(&value, context()->v8_context()); | 79 result = converter->ToV8Value(&value, context()->v8_context()); |
| 78 } | 80 } |
| 79 args.GetReturnValue().Set(result); | 81 args.GetReturnValue().Set(result); |
| 80 } | 82 } |
| 81 | 83 |
| 82 } // namespace extensions | 84 } // namespace extensions |
| OLD | NEW |