| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cros/language_library.h" | 5 #include "chrome/browser/chromeos/cros/language_library.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // Finds a property which has |new_prop.key| from |prop_list|, and replaces the | 25 // Finds a property which has |new_prop.key| from |prop_list|, and replaces the |
| 26 // property with |new_prop|. Returns true if such a property is found. | 26 // property with |new_prop|. Returns true if such a property is found. |
| 27 bool FindAndUpdateProperty(const chromeos::ImeProperty& new_prop, | 27 bool FindAndUpdateProperty(const chromeos::ImeProperty& new_prop, |
| 28 chromeos::ImePropertyList* prop_list) { | 28 chromeos::ImePropertyList* prop_list) { |
| 29 for (size_t i = 0; i < prop_list->size(); ++i) { | 29 for (size_t i = 0; i < prop_list->size(); ++i) { |
| 30 chromeos::ImeProperty& prop = prop_list->at(i); | 30 chromeos::ImeProperty& prop = prop_list->at(i); |
| 31 if (prop.key == new_prop.key) { | 31 if (prop.key == new_prop.key) { |
| 32 const int saved_id = prop.selection_item_id; | 32 const int saved_id = prop.selection_item_id; |
| 33 // Update the list except the radio id. As written in chromeos_language.h, | 33 // Update the list except the radio id. As written in |
| 34 // |prop.selection_item_id| is dummy. | 34 // chromeos_input_method.h, |prop.selection_item_id| is dummy. |
| 35 prop = new_prop; | 35 prop = new_prop; |
| 36 prop.selection_item_id = saved_id; | 36 prop.selection_item_id = saved_id; |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 | 42 |
| 43 // There are some differences between ISO 639-2 (T) and ISO 639-2 B, and | 43 // There are some differences between ISO 639-2 (T) and ISO 639-2 B, and |
| 44 // some language codes are not recognized by ICU (i.e. ICU cannot convert | 44 // some language codes are not recognized by ICU (i.e. ICU cannot convert |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 NewRunnableMethod( | 385 NewRunnableMethod( |
| 386 this, &LanguageLibraryImpl::FocusChanged, is_focused)); | 386 this, &LanguageLibraryImpl::FocusChanged, is_focused)); |
| 387 return; | 387 return; |
| 388 } | 388 } |
| 389 | 389 |
| 390 is_focused_ = is_focused; | 390 is_focused_ = is_focused; |
| 391 FOR_EACH_OBSERVER(Observer, observers_, FocusChanged(this)); | 391 FOR_EACH_OBSERVER(Observer, observers_, FocusChanged(this)); |
| 392 } | 392 } |
| 393 | 393 |
| 394 } // namespace chromeos | 394 } // namespace chromeos |
| OLD | NEW |