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

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: 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') | ui/base/x/x11_util.cc » ('J')
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> 7 #include <algorithm>
sky 2015/12/01 22:08:31 I suspect you can nuke this include from all these
tfarina 2015/12/02 20:31:41 Done.
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/stl_util.h"
12 #include "base/win/windows_version.h" 13 #include "base/win/windows_version.h"
13 14
14 namespace ui { 15 namespace ui {
15 namespace tsf_inputscope { 16 namespace tsf_inputscope {
16 namespace { 17 namespace {
17 18
18 void AppendNonTrivialInputScope(std::vector<InputScope>* input_scopes, 19 void AppendNonTrivialInputScope(std::vector<InputScope>* input_scopes,
19 InputScope input_scope) { 20 InputScope input_scope) {
20 DCHECK(input_scopes); 21 DCHECK(input_scopes);
21 22
22 if (input_scope == IS_DEFAULT) 23 if (input_scope == IS_DEFAULT)
23 return; 24 return;
24 25
25 if (std::find(input_scopes->begin(), input_scopes->end(), input_scope) != 26 if (ContainsValue(*input_scopes, input_scope))
26 input_scopes->end())
27 return; 27 return;
28 28
29 input_scopes->push_back(input_scope); 29 input_scopes->push_back(input_scope);
30 } 30 }
31 31
32 class TSFInputScope final : public ITfInputScope { 32 class TSFInputScope final : public ITfInputScope {
33 public: 33 public:
34 explicit TSFInputScope(const std::vector<InputScope>& input_scopes) 34 explicit TSFInputScope(const std::vector<InputScope>& input_scopes)
35 : input_scopes_(input_scopes), 35 : input_scopes_(input_scopes),
36 ref_count_(0) {} 36 ref_count_(0) {}
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return; 204 return;
205 205
206 std::vector<InputScope> input_scopes = GetInputScopes(text_input_type, 206 std::vector<InputScope> input_scopes = GetInputScopes(text_input_type,
207 text_input_mode); 207 text_input_mode);
208 g_set_input_scopes(window_handle, &input_scopes[0], input_scopes.size(), 208 g_set_input_scopes(window_handle, &input_scopes[0], input_scopes.size(),
209 NULL, 0, NULL, NULL); 209 NULL, 0, NULL, NULL);
210 } 210 }
211 211
212 } // namespace tsf_inputscope 212 } // namespace tsf_inputscope
213 } // namespace ui 213 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/base/win/hwnd_subclass.cc » ('j') | ui/base/x/x11_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698