| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
| 6 | 6 |
| 7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 iter != virtual_keyboard_pref->end_keys(); | 581 iter != virtual_keyboard_pref->end_keys(); |
| 582 ++iter) { | 582 ++iter) { |
| 583 const std::string& layout_id = *iter; // e.g. "us", "handwriting-vk" | 583 const std::string& layout_id = *iter; // e.g. "us", "handwriting-vk" |
| 584 if (!virtual_keyboard_pref->GetString(layout_id, &url)) | 584 if (!virtual_keyboard_pref->GetString(layout_id, &url)) |
| 585 continue; | 585 continue; |
| 586 if (!input_method_manager->SetVirtualKeyboardPreference( | 586 if (!input_method_manager->SetVirtualKeyboardPreference( |
| 587 layout_id, GURL(url))) { | 587 layout_id, GURL(url))) { |
| 588 // Either |layout_id| or |url| is invalid. Remove the key from |prefs| | 588 // Either |layout_id| or |url| is invalid. Remove the key from |prefs| |
| 589 // later. | 589 // later. |
| 590 layouts_to_remove.push_back(layout_id); | 590 layouts_to_remove.push_back(layout_id); |
| 591 LOG(ERROR) << "Removing invalid virtual keyboard pref: layout=" << layout; | 591 LOG(ERROR) << "Removing invalid virtual keyboard pref: layout=" |
| 592 << layout_id; |
| 592 } | 593 } |
| 593 } | 594 } |
| 594 | 595 |
| 595 // Remove invalid prefs. | 596 // Remove invalid prefs. |
| 596 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); | 597 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); |
| 597 DictionaryValue* pref_value = updater.Get(); | 598 DictionaryValue* pref_value = updater.Get(); |
| 598 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { | 599 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { |
| 599 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); | 600 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); |
| 600 } | 601 } |
| 601 } | 602 } |
| 602 | 603 |
| 603 } // namespace chromeos | 604 } // namespace chromeos |
| OLD | NEW |