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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_util.cc

Issue 1715683002: chrome: Use base's ContainsValue helper function instead of std::find (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per latest code Created 4 years, 10 months 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
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 "chrome/browser/chromeos/input_method/input_method_util.h" 5 #include "chrome/browser/chromeos/input_method/input_method_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm>
10 #include <functional> 9 #include <functional>
11 #include <map> 10 #include <map>
12 #include <utility> 11 #include <utility>
13 12
14 #include "base/macros.h" 13 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/stl_util.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "chrome/common/extensions/extension_constants.h" 19 #include "chrome/common/extensions/extension_constants.h"
20 #include "components/prefs/pref_service.h" 20 #include "components/prefs/pref_service.h"
21 21
22 // TODO(nona): move this header from this file. 22 // TODO(nona): move this header from this file.
23 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
24 24
25 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" 25 #include "ui/base/ime/chromeos/component_extension_ime_manager.h"
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 std::vector<std::string>& ids = *input_method_ids; 683 std::vector<std::string>& ids = *input_method_ids;
684 for (size_t i = 0; i < ids.size(); ++i) { 684 for (size_t i = 0; i < ids.size(); ++i) {
685 std::string id = MigrateInputMethod(ids[i]); 685 std::string id = MigrateInputMethod(ids[i]);
686 if (id != ids[i]) { 686 if (id != ids[i]) {
687 ids[i] = id; 687 ids[i] = id;
688 rewritten = true; 688 rewritten = true;
689 } 689 }
690 } 690 }
691 if (rewritten) { 691 if (rewritten) {
692 // Removes the duplicates. 692 // Removes the duplicates.
693 std::vector<std::string> new_ids; 693 std::vector<std::string> new_ids;
sky 2016/03/02 17:19:34 Make this use std::unique
chakshu 2016/03/07 08:10:46 Done.
694 for (size_t i = 0; i < ids.size(); ++i) { 694 for (size_t i = 0; i < ids.size(); ++i) {
695 if (std::find(new_ids.begin(), new_ids.end(), ids[i]) == new_ids.end()) 695 if (!ContainsValue(new_ids, ids[i]))
696 new_ids.push_back(ids[i]); 696 new_ids.push_back(ids[i]);
697 } 697 }
698 ids.swap(new_ids); 698 ids.swap(new_ids);
699 } 699 }
700 return rewritten; 700 return rewritten;
701 } 701 }
702 702
703 void InputMethodUtil::UpdateHardwareLayoutCache() { 703 void InputMethodUtil::UpdateHardwareLayoutCache() {
704 DCHECK(thread_checker_.CalledOnValidThread()); 704 DCHECK(thread_checker_.CalledOnValidThread());
705 hardware_layouts_.clear(); 705 hardware_layouts_.clear();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 "US", 826 "US",
827 layouts, 827 layouts,
828 languages, 828 languages,
829 true, // login keyboard. 829 true, // login keyboard.
830 GURL(), // options page, not available. 830 GURL(), // options page, not available.
831 GURL()); // input view page, not available. 831 GURL()); // input view page, not available.
832 } 832 }
833 833
834 } // namespace input_method 834 } // namespace input_method
835 } // namespace chromeos 835 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698