| OLD | NEW | 
|    1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2010 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/options/language_hangul_config_view.h" |    5 #include "chrome/browser/chromeos/options/language_hangul_config_view.h" | 
|    6  |    6  | 
|    7 #include "app/combobox_model.h" |    7 #include "app/combobox_model.h" | 
|    8 #include "app/l10n_util.h" |    8 #include "app/l10n_util.h" | 
 |    9 #include "chrome/browser/chromeos/cros/cros_library.h" | 
|    9 #include "chrome/browser/chromeos/cros/language_library.h" |   10 #include "chrome/browser/chromeos/cros/language_library.h" | 
|   10 #include "grit/generated_resources.h" |   11 #include "grit/generated_resources.h" | 
|   11 #include "grit/locale_settings.h" |   12 #include "grit/locale_settings.h" | 
|   12 #include "views/controls/button/checkbox.h" |   13 #include "views/controls/button/checkbox.h" | 
|   13 #include "views/controls/label.h" |   14 #include "views/controls/label.h" | 
|   14 #include "views/grid_layout.h" |   15 #include "views/grid_layout.h" | 
|   15 #include "views/standard_layout.h" |   16 #include "views/standard_layout.h" | 
|   16 #include "views/window/window.h" |   17 #include "views/window/window.h" | 
|   17  |   18  | 
|   18 namespace chromeos { |   19 namespace chromeos { | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   69       } |   70       } | 
|   70     } |   71     } | 
|   71     return -1; |   72     return -1; | 
|   72   } |   73   } | 
|   73  |   74  | 
|   74  private: |   75  private: | 
|   75   std::vector<std::pair<std::wstring, std::string> > layouts_; |   76   std::vector<std::pair<std::wstring, std::string> > layouts_; | 
|   76   DISALLOW_COPY_AND_ASSIGN(HangulKeyboardComboboxModel); |   77   DISALLOW_COPY_AND_ASSIGN(HangulKeyboardComboboxModel); | 
|   77 }; |   78 }; | 
|   78  |   79  | 
|   79 LanguageHangulConfigView::LanguageHangulConfigView() : |   80 LanguageHangulConfigView::LanguageHangulConfigView() | 
|   80     contents_(NULL), |   81     : contents_(NULL), | 
|   81     hangul_keyboard_combobox_(NULL), |   82       hangul_keyboard_combobox_(NULL), | 
|   82     hangul_keyboard_combobox_model_(new HangulKeyboardComboboxModel) { |   83       hangul_keyboard_combobox_model_(new HangulKeyboardComboboxModel) { | 
|   83 } |   84 } | 
|   84  |   85  | 
|   85 LanguageHangulConfigView::~LanguageHangulConfigView() { |   86 LanguageHangulConfigView::~LanguageHangulConfigView() { | 
|   86 } |   87 } | 
|   87  |   88  | 
|   88 void LanguageHangulConfigView::ItemChanged( |   89 void LanguageHangulConfigView::ItemChanged( | 
|   89     views::Combobox* sender, int prev_index, int new_index) { |   90     views::Combobox* sender, int prev_index, int new_index) { | 
|   90   ImeConfigValue config; |   91   ImeConfigValue config; | 
|   91   config.type = ImeConfigValue::kValueTypeString; |   92   config.type = ImeConfigValue::kValueTypeString; | 
|   92   config.string_value = |   93   config.string_value = | 
|   93       hangul_keyboard_combobox_model_->GetItemIDAt(new_index); |   94       hangul_keyboard_combobox_model_->GetItemIDAt(new_index); | 
|   94   LanguageLibrary::Get()->SetImeConfig( |   95   CrosLibrary::Get()->GetLanguageLibrary()->SetImeConfig( | 
|   95       kHangulSection, kHangulKeyboardConfigName, config); |   96       kHangulSection, kHangulKeyboardConfigName, config); | 
|   96  |   97  | 
|   97   UpdateHangulKeyboardCombobox(); |   98   UpdateHangulKeyboardCombobox(); | 
|   98 } |   99 } | 
|   99  |  100  | 
|  100 void LanguageHangulConfigView::Layout() { |  101 void LanguageHangulConfigView::Layout() { | 
|  101   // Not sure why but this is needed to show contents in the dialog. |  102   // Not sure why but this is needed to show contents in the dialog. | 
|  102   contents_->SetBounds(0, 0, width(), height()); |  103   contents_->SetBounds(0, 0, width(), height()); | 
|  103 } |  104 } | 
|  104  |  105  | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  151   hangul_keyboard_combobox_ |  152   hangul_keyboard_combobox_ | 
|  152       = new views::Combobox(hangul_keyboard_combobox_model_.get()); |  153       = new views::Combobox(hangul_keyboard_combobox_model_.get()); | 
|  153   hangul_keyboard_combobox_->set_listener(this); |  154   hangul_keyboard_combobox_->set_listener(this); | 
|  154   UpdateHangulKeyboardCombobox(); |  155   UpdateHangulKeyboardCombobox(); | 
|  155   layout->AddView(hangul_keyboard_combobox_); |  156   layout->AddView(hangul_keyboard_combobox_); | 
|  156 } |  157 } | 
|  157  |  158  | 
|  158 void LanguageHangulConfigView::UpdateHangulKeyboardCombobox() { |  159 void LanguageHangulConfigView::UpdateHangulKeyboardCombobox() { | 
|  159   DCHECK(hangul_keyboard_combobox_); |  160   DCHECK(hangul_keyboard_combobox_); | 
|  160   ImeConfigValue config; |  161   ImeConfigValue config; | 
|  161   if (LanguageLibrary::Get()->GetImeConfig( |  162   if (CrosLibrary::Get()->GetLanguageLibrary()->GetImeConfig( | 
|  162           kHangulSection, kHangulKeyboardConfigName, &config)) { |  163           kHangulSection, kHangulKeyboardConfigName, &config)) { | 
|  163     const int index |  164     const int index | 
|  164         = hangul_keyboard_combobox_model_->GetIndexFromID(config.string_value); |  165         = hangul_keyboard_combobox_model_->GetIndexFromID(config.string_value); | 
|  165     if (index >= 0) { |  166     if (index >= 0) { | 
|  166       hangul_keyboard_combobox_->SetSelectedItem(index); |  167       hangul_keyboard_combobox_->SetSelectedItem(index); | 
|  167     } |  168     } | 
|  168   } |  169   } | 
|  169 } |  170 } | 
|  170  |  171  | 
|  171 }  // namespace chromeos |  172 }  // namespace chromeos | 
| OLD | NEW |