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

Side by Side Diff: content/browser/renderer_host/ime_adapter_android.cc

Issue 834133004: Don't initialize C++ constants in Java during JNI registration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: multi-line package name yet again Created 5 years, 11 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 | « content/browser/android/load_url_params.cc ('k') | content/content.gyp » ('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 "content/browser/renderer_host/ime_adapter_android.h" 5 #include "content/browser/renderer_host/ime_adapter_android.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <android/input.h> 8 #include <android/input.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 type = blink::WebInputEvent::KeyUp; 59 type = blink::WebInputEvent::KeyUp;
60 else 60 else
61 NOTREACHED() << "Invalid Android key event action: " << action; 61 NOTREACHED() << "Invalid Android key event action: " << action;
62 return NativeWebKeyboardEvent(java_key_event, type, modifiers, 62 return NativeWebKeyboardEvent(java_key_event, type, modifiers,
63 time_ms / 1000.0, key_code, unicode_char, is_system_key); 63 time_ms / 1000.0, key_code, unicode_char, is_system_key);
64 } 64 }
65 65
66 } // anonymous namespace 66 } // anonymous namespace
67 67
68 bool RegisterImeAdapter(JNIEnv* env) { 68 bool RegisterImeAdapter(JNIEnv* env) {
69 if (!RegisterNativesImpl(env)) 69 return RegisterNativesImpl(env);
70 return false;
71
72 Java_ImeAdapter_initializeWebInputEvents(env,
73 blink::WebInputEvent::RawKeyDown,
74 blink::WebInputEvent::KeyUp,
75 blink::WebInputEvent::Char,
76 blink::WebInputEvent::ShiftKey,
77 blink::WebInputEvent::AltKey,
78 blink::WebInputEvent::ControlKey,
79 blink::WebInputEvent::CapsLockOn,
80 blink::WebInputEvent::NumLockOn);
81 Java_ImeAdapter_initializeTextInputFlags(
82 env,
83 blink::WebTextInputFlagAutocompleteOn,
84 blink::WebTextInputFlagAutocompleteOff,
85 blink::WebTextInputFlagAutocorrectOn,
86 blink::WebTextInputFlagAutocorrectOff,
87 blink::WebTextInputFlagSpellcheckOn,
88 blink::WebTextInputFlagSpellcheckOff);
89 return true;
90 } 70 }
91 71
92 // Callback from Java to convert BackgroundColorSpan data to a 72 // Callback from Java to convert BackgroundColorSpan data to a
93 // blink::WebCompositionUnderline instance, and append it to |underlines_ptr|. 73 // blink::WebCompositionUnderline instance, and append it to |underlines_ptr|.
94 void AppendBackgroundColorSpan(JNIEnv*, 74 void AppendBackgroundColorSpan(JNIEnv*,
95 jclass, 75 jclass,
96 jlong underlines_ptr, 76 jlong underlines_ptr,
97 jint start, 77 jint start,
98 jint end, 78 jint end,
99 jint background_color) { 79 jint background_color) {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 WebContents* ImeAdapterAndroid::GetWebContents() { 331 WebContents* ImeAdapterAndroid::GetWebContents() {
352 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); 332 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl();
353 if (!rwh) 333 if (!rwh)
354 return NULL; 334 return NULL;
355 if (!rwh->IsRenderView()) 335 if (!rwh->IsRenderView())
356 return NULL; 336 return NULL;
357 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); 337 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh));
358 } 338 }
359 339
360 } // namespace content 340 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/load_url_params.cc ('k') | content/content.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698