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

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

Issue 1830543003: Using STL to implement functionality in input_method_util.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per latest code Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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 "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> 9 #include <algorithm>
10 #include <functional> 10 #include <functional>
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <unordered_set>
13 #include <utility> 14 #include <utility>
14 15
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/strings/string_split.h" 17 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
19 #include "chrome/common/extensions/extension_constants.h" 20 #include "chrome/common/extensions/extension_constants.h"
20 // TODO(nona): move this header from this file. 21 // TODO(nona): move this header from this file.
21 #include "chrome/grit/generated_resources.h" 22 #include "chrome/grit/generated_resources.h"
22 #include "components/prefs/pref_service.h" 23 #include "components/prefs/pref_service.h"
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 for (size_t i = 0; i < ids.size(); ++i) { 681 for (size_t i = 0; i < ids.size(); ++i) {
681 std::string id = MigrateInputMethod(ids[i]); 682 std::string id = MigrateInputMethod(ids[i]);
682 if (id != ids[i]) { 683 if (id != ids[i]) {
683 ids[i] = id; 684 ids[i] = id;
684 rewritten = true; 685 rewritten = true;
685 } 686 }
686 } 687 }
687 if (rewritten) { 688 if (rewritten) {
688 // Removes the duplicates. 689 // Removes the duplicates.
689 std::vector<std::string> new_ids; 690 std::vector<std::string> new_ids;
691 std::unordered_set<std::string> ids_set;
690 for (size_t i = 0; i < ids.size(); ++i) { 692 for (size_t i = 0; i < ids.size(); ++i) {
691 if (std::find(new_ids.begin(), new_ids.end(), ids[i]) == new_ids.end()) 693 if (ids_set.find(ids[i]) == ids_set.end())
692 new_ids.push_back(ids[i]); 694 new_ids.push_back(ids[i]);
695 ids_set.insert(ids[i]);
693 } 696 }
694 ids.swap(new_ids); 697 ids.swap(new_ids);
695 } 698 }
696 return rewritten; 699 return rewritten;
697 } 700 }
698 701
699 void InputMethodUtil::UpdateHardwareLayoutCache() { 702 void InputMethodUtil::UpdateHardwareLayoutCache() {
700 DCHECK(thread_checker_.CalledOnValidThread()); 703 DCHECK(thread_checker_.CalledOnValidThread());
701 hardware_layouts_.clear(); 704 hardware_layouts_.clear();
702 hardware_login_layouts_.clear(); 705 hardware_login_layouts_.clear();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 "US", 825 "US",
823 layouts, 826 layouts,
824 languages, 827 languages,
825 true, // login keyboard. 828 true, // login keyboard.
826 GURL(), // options page, not available. 829 GURL(), // options page, not available.
827 GURL()); // input view page, not available. 830 GURL()); // input view page, not available.
828 } 831 }
829 832
830 } // namespace input_method 833 } // namespace input_method
831 } // namespace chromeos 834 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698