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 "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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 } // anonymous namespace | 66 } // anonymous namespace |
67 | 67 |
68 bool RegisterImeAdapter(JNIEnv* env) { | 68 bool RegisterImeAdapter(JNIEnv* env) { |
69 return RegisterNativesImpl(env); | 69 return RegisterNativesImpl(env); |
70 } | 70 } |
71 | 71 |
72 // Callback from Java to convert BackgroundColorSpan data to a | 72 // Callback from Java to convert BackgroundColorSpan data to a |
73 // blink::WebCompositionUnderline instance, and append it to |underlines_ptr|. | 73 // blink::WebCompositionUnderline instance, and append it to |underlines_ptr|. |
74 void AppendBackgroundColorSpan(JNIEnv*, | 74 void AppendBackgroundColorSpan(JNIEnv*, |
75 jclass, | 75 const JavaParamRef<jclass>&, |
76 jlong underlines_ptr, | 76 jlong underlines_ptr, |
77 jint start, | 77 jint start, |
78 jint end, | 78 jint end, |
79 jint background_color) { | 79 jint background_color) { |
80 DCHECK_GE(start, 0); | 80 DCHECK_GE(start, 0); |
81 DCHECK_GE(end, 0); | 81 DCHECK_GE(end, 0); |
82 // Do not check |background_color|. | 82 // Do not check |background_color|. |
83 std::vector<blink::WebCompositionUnderline>* underlines = | 83 std::vector<blink::WebCompositionUnderline>* underlines = |
84 reinterpret_cast<std::vector<blink::WebCompositionUnderline>*>( | 84 reinterpret_cast<std::vector<blink::WebCompositionUnderline>*>( |
85 underlines_ptr); | 85 underlines_ptr); |
86 underlines->push_back( | 86 underlines->push_back( |
87 blink::WebCompositionUnderline(static_cast<unsigned>(start), | 87 blink::WebCompositionUnderline(static_cast<unsigned>(start), |
88 static_cast<unsigned>(end), | 88 static_cast<unsigned>(end), |
89 SK_ColorTRANSPARENT, | 89 SK_ColorTRANSPARENT, |
90 false, | 90 false, |
91 static_cast<unsigned>(background_color))); | 91 static_cast<unsigned>(background_color))); |
92 } | 92 } |
93 | 93 |
94 // Callback from Java to convert UnderlineSpan data to a | 94 // Callback from Java to convert UnderlineSpan data to a |
95 // blink::WebCompositionUnderline instance, and append it to |underlines_ptr|. | 95 // blink::WebCompositionUnderline instance, and append it to |underlines_ptr|. |
96 void AppendUnderlineSpan(JNIEnv*, | 96 void AppendUnderlineSpan(JNIEnv*, |
97 jclass, | 97 const JavaParamRef<jclass>&, |
98 jlong underlines_ptr, | 98 jlong underlines_ptr, |
99 jint start, | 99 jint start, |
100 jint end) { | 100 jint end) { |
101 DCHECK_GE(start, 0); | 101 DCHECK_GE(start, 0); |
102 DCHECK_GE(end, 0); | 102 DCHECK_GE(end, 0); |
103 std::vector<blink::WebCompositionUnderline>* underlines = | 103 std::vector<blink::WebCompositionUnderline>* underlines = |
104 reinterpret_cast<std::vector<blink::WebCompositionUnderline>*>( | 104 reinterpret_cast<std::vector<blink::WebCompositionUnderline>*>( |
105 underlines_ptr); | 105 underlines_ptr); |
106 underlines->push_back( | 106 underlines->push_back( |
107 blink::WebCompositionUnderline(static_cast<unsigned>(start), | 107 blink::WebCompositionUnderline(static_cast<unsigned>(start), |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 WebContents* ImeAdapterAndroid::GetWebContents() { | 301 WebContents* ImeAdapterAndroid::GetWebContents() { |
302 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 302 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
303 if (!rwh) | 303 if (!rwh) |
304 return NULL; | 304 return NULL; |
305 if (!rwh->IsRenderView()) | 305 if (!rwh->IsRenderView()) |
306 return NULL; | 306 return NULL; |
307 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); | 307 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); |
308 } | 308 } |
309 | 309 |
310 } // namespace content | 310 } // namespace content |
OLD | NEW |