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 "chrome/browser/chromeos/input_method/input_method_manager_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" |
6 | 6 |
7 #include <algorithm> // std::find | 7 #include <algorithm> // std::find |
8 | 8 |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 // input_method_ids[0] now contains the most popular keyboard layout | 599 // input_method_ids[0] now contains the most popular keyboard layout |
600 // for the given locale. | 600 // for the given locale. |
601 DCHECK_GE(input_method_ids.size(), 1U); | 601 DCHECK_GE(input_method_ids.size(), 1U); |
602 layout = input_method_ids[0]; | 602 layout = input_method_ids[0]; |
603 } | 603 } |
604 } | 604 } |
605 | 605 |
606 if (layout.empty()) | 606 if (layout.empty()) |
607 return; | 607 return; |
608 | 608 |
609 std::vector<std::string> layouts; | 609 std::vector<std::string> layouts = base::SplitString( |
610 base::SplitString(layout, ',', &layouts); | 610 layout, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
611 manager_->MigrateInputMethods(&layouts); | 611 manager_->MigrateInputMethods(&layouts); |
612 | 612 |
613 PrefService* prefs = g_browser_process->local_state(); | 613 PrefService* prefs = g_browser_process->local_state(); |
614 prefs->SetString(prefs::kHardwareKeyboardLayout, | 614 prefs->SetString(prefs::kHardwareKeyboardLayout, |
615 base::JoinString(layouts, ",")); | 615 base::JoinString(layouts, ",")); |
616 | 616 |
617 // This asks the file thread to save the prefs (i.e. doesn't block). | 617 // This asks the file thread to save the prefs (i.e. doesn't block). |
618 // The latest values of Local State reside in memory so we can safely | 618 // The latest values of Local State reside in memory so we can safely |
619 // get the value of kHardwareKeyboardLayout even if the data is not | 619 // get the value of kHardwareKeyboardLayout even if the data is not |
620 // yet saved to disk. | 620 // yet saved to disk. |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 if (candidate_window_controller_.get()) | 1149 if (candidate_window_controller_.get()) |
1150 return; | 1150 return; |
1151 | 1151 |
1152 candidate_window_controller_.reset( | 1152 candidate_window_controller_.reset( |
1153 CandidateWindowController::CreateCandidateWindowController()); | 1153 CandidateWindowController::CreateCandidateWindowController()); |
1154 candidate_window_controller_->AddObserver(this); | 1154 candidate_window_controller_->AddObserver(this); |
1155 } | 1155 } |
1156 | 1156 |
1157 } // namespace input_method | 1157 } // namespace input_method |
1158 } // namespace chromeos | 1158 } // namespace chromeos |
OLD | NEW |