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

Side by Side Diff: athena/virtual_keyboard/virtual_keyboard_bindings_impl.cc

Issue 348823003: athena: Provide a temporary onTextInputBoxFocused.addListener implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/virtual_keyboard/public/virtual_keyboard_bindings.h" 5 #include "athena/virtual_keyboard/public/virtual_keyboard_bindings.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 v8::Handle<v8::Object> chrome = 99 v8::Handle<v8::Object> chrome =
100 global->Get(gin::StringToV8(isolate, "chrome"))->ToObject(); 100 global->Get(gin::StringToV8(isolate, "chrome"))->ToObject();
101 CHECK(!chrome.IsEmpty()); 101 CHECK(!chrome.IsEmpty());
102 102
103 gin::Handle<VKBindings> controller = 103 gin::Handle<VKBindings> controller =
104 gin::CreateHandle(isolate, new VKBindings(render_view)); 104 gin::CreateHandle(isolate, new VKBindings(render_view));
105 if (controller.IsEmpty()) 105 if (controller.IsEmpty())
106 return; 106 return;
107 chrome->Set(gin::StringToSymbol(isolate, "virtualKeyboardPrivate"), 107 chrome->Set(gin::StringToSymbol(isolate, "virtualKeyboardPrivate"),
108 controller.ToV8()); 108 controller.ToV8());
109
110 const std::string kInputBoxFocusedEvent =
111 "chrome.virtualKeyboardPrivate.onTextInputBoxFocused = {};"
112 "chrome.virtualKeyboardPrivate.onTextInputBoxFocused.addListener = "
113 " function(callback) { "
114 " window.setTimeout(function() {"
115 " callback({type: 'text'});"
116 " }, 100);"
117 " };";
118 render_view->GetMainRenderFrame()->ExecuteJavaScript(
119 base::UTF8ToUTF16(kInputBoxFocusedEvent));
bshe 2014/06/20 21:00:30 Just curios when is this javascript been executed?
sadrul 2014/06/20 22:24:46 This happens when the page navigates to chrome://k
109 } 120 }
110 121
111 private: 122 private:
112 explicit VKBindings(content::RenderView* render_view) 123 explicit VKBindings(content::RenderView* render_view)
113 : render_view_(render_view) {} 124 : render_view_(render_view) {}
114 virtual ~VKBindings() {} 125 virtual ~VKBindings() {}
115 126
116 // gin::WrappableBase 127 // gin::WrappableBase
117 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( 128 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
118 v8::Isolate* isolate) OVERRIDE { 129 v8::Isolate* isolate) OVERRIDE {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 }; 193 };
183 194
184 } // namespace 195 } // namespace
185 196
186 VirtualKeyboardBindings* VirtualKeyboardBindings::Create( 197 VirtualKeyboardBindings* VirtualKeyboardBindings::Create(
187 content::RenderView* render_view) { 198 content::RenderView* render_view) {
188 return new VirtualKeyboardBindingsImpl(render_view); 199 return new VirtualKeyboardBindingsImpl(render_view);
189 } 200 }
190 201
191 } // namespace athena 202 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698