| 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 "ui/base/ime/win/tsf_input_scope.h" | 5 #include "ui/base/ime/win/tsf_input_scope.h" |
| 6 | 6 |
| 7 #include <algorithm> | |
| 8 | |
| 9 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 8 #include "base/logging.h" |
| 11 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/stl_util.h" |
| 12 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
| 13 | 12 |
| 14 namespace ui { | 13 namespace ui { |
| 15 namespace tsf_inputscope { | 14 namespace tsf_inputscope { |
| 16 namespace { | 15 namespace { |
| 17 | 16 |
| 18 void AppendNonTrivialInputScope(std::vector<InputScope>* input_scopes, | 17 void AppendNonTrivialInputScope(std::vector<InputScope>* input_scopes, |
| 19 InputScope input_scope) { | 18 InputScope input_scope) { |
| 20 DCHECK(input_scopes); | 19 DCHECK(input_scopes); |
| 21 | 20 |
| 22 if (input_scope == IS_DEFAULT) | 21 if (input_scope == IS_DEFAULT) |
| 23 return; | 22 return; |
| 24 | 23 |
| 25 if (std::find(input_scopes->begin(), input_scopes->end(), input_scope) != | 24 if (ContainsValue(*input_scopes, input_scope)) |
| 26 input_scopes->end()) | |
| 27 return; | 25 return; |
| 28 | 26 |
| 29 input_scopes->push_back(input_scope); | 27 input_scopes->push_back(input_scope); |
| 30 } | 28 } |
| 31 | 29 |
| 32 class TSFInputScope final : public ITfInputScope { | 30 class TSFInputScope final : public ITfInputScope { |
| 33 public: | 31 public: |
| 34 explicit TSFInputScope(const std::vector<InputScope>& input_scopes) | 32 explicit TSFInputScope(const std::vector<InputScope>& input_scopes) |
| 35 : input_scopes_(input_scopes), | 33 : input_scopes_(input_scopes), |
| 36 ref_count_(0) {} | 34 ref_count_(0) {} |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 return; | 202 return; |
| 205 | 203 |
| 206 std::vector<InputScope> input_scopes = GetInputScopes(text_input_type, | 204 std::vector<InputScope> input_scopes = GetInputScopes(text_input_type, |
| 207 text_input_mode); | 205 text_input_mode); |
| 208 g_set_input_scopes(window_handle, &input_scopes[0], input_scopes.size(), | 206 g_set_input_scopes(window_handle, &input_scopes[0], input_scopes.size(), |
| 209 NULL, 0, NULL, NULL); | 207 NULL, 0, NULL, NULL); |
| 210 } | 208 } |
| 211 | 209 |
| 212 } // namespace tsf_inputscope | 210 } // namespace tsf_inputscope |
| 213 } // namespace ui | 211 } // namespace ui |
| OLD | NEW |