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

Side by Side Diff: ui/base/ime/win/tsf_input_scope.cc

Issue 1485093003: ui: use base's ContainsValue helper function instead of std::find (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review + view.cc fix Created 5 years 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 | « no previous file | ui/base/win/hwnd_subclass.cc » ('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 "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
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
OLDNEW
« no previous file with comments | « no previous file | ui/base/win/hwnd_subclass.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698