OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/spellchecker/spellchecker_session_bridge_android.h" | 5 #include "chrome/browser/spellchecker/spellchecker_session_bridge_android.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
10 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
11 #include "chrome/common/spellcheck_messages.h" | 12 #include "chrome/common/spellcheck_messages.h" |
12 #include "chrome/common/spellcheck_result.h" | 13 #include "chrome/common/spellcheck_result.h" |
13 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
14 #include "jni/SpellCheckerSessionBridge_jni.h" | 15 #include "jni/SpellCheckerSessionBridge_jni.h" |
15 | 16 |
16 SpellCheckerSessionBridge::SpellCheckerSessionBridge(int render_process_id) | 17 SpellCheckerSessionBridge::SpellCheckerSessionBridge(int render_process_id) |
17 : render_process_id_(render_process_id) {} | 18 : render_process_id_(render_process_id) {} |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 82 |
82 content::RenderProcessHost* sender = | 83 content::RenderProcessHost* sender = |
83 content::RenderProcessHost::FromID(render_process_id_); | 84 content::RenderProcessHost::FromID(render_process_id_); |
84 | 85 |
85 if (sender != nullptr) { | 86 if (sender != nullptr) { |
86 sender->Send(new SpellCheckMsg_RespondTextCheck( | 87 sender->Send(new SpellCheckMsg_RespondTextCheck( |
87 active_request_->route_id, active_request_->identifier, | 88 active_request_->route_id, active_request_->identifier, |
88 active_request_->text, results)); | 89 active_request_->text, results)); |
89 } | 90 } |
90 | 91 |
91 active_request_ = pending_request_.Pass(); | 92 active_request_ = std::move(pending_request_); |
92 if (active_request_) { | 93 if (active_request_) { |
93 JNIEnv* env = base::android::AttachCurrentThread(); | 94 JNIEnv* env = base::android::AttachCurrentThread(); |
94 Java_SpellCheckerSessionBridge_requestTextCheck( | 95 Java_SpellCheckerSessionBridge_requestTextCheck( |
95 env, java_object_.obj(), | 96 env, java_object_.obj(), |
96 base::android::ConvertUTF16ToJavaString(env, active_request_->text) | 97 base::android::ConvertUTF16ToJavaString(env, active_request_->text) |
97 .obj()); | 98 .obj()); |
98 } | 99 } |
99 } | 100 } |
100 | 101 |
101 void SpellCheckerSessionBridge::DisconnectSession() { | 102 void SpellCheckerSessionBridge::DisconnectSession() { |
102 java_object_.Reset(); | 103 java_object_.Reset(); |
103 } | 104 } |
104 | 105 |
105 SpellCheckerSessionBridge::SpellingRequest::SpellingRequest( | 106 SpellCheckerSessionBridge::SpellingRequest::SpellingRequest( |
106 int route_id, | 107 int route_id, |
107 int identifier, | 108 int identifier, |
108 const base::string16& text) | 109 const base::string16& text) |
109 : route_id(route_id), identifier(identifier), text(text) {} | 110 : route_id(route_id), identifier(identifier), text(text) {} |
110 | 111 |
111 SpellCheckerSessionBridge::SpellingRequest::~SpellingRequest() {} | 112 SpellCheckerSessionBridge::SpellingRequest::~SpellingRequest() {} |
OLD | NEW |