Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: extensions/renderer/app_window_custom_bindings.cc

Issue 1945433002: [Extensions] Update more bindings and allow for multiple feature access (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Antony's Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | extensions/renderer/blob_native_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/blob_native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698