| 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 "ash/system/ime/tray_ime.h" | 5 #include "ash/system/ime/tray_ime.h" |
| 6 | 6 |
| 7 #include <utility> | |
| 8 #include <vector> | 7 #include <vector> |
| 9 | 8 |
| 10 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 11 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| 12 #include "ash/system/tray/system_tray_delegate.h" | 11 #include "ash/system/tray/system_tray_delegate.h" |
| 13 #include "ash/system/tray/tray_constants.h" | 12 #include "ash/system/tray/tray_constants.h" |
| 14 #include "ash/system/tray/tray_item_more.h" | 13 #include "ash/system/tray/tray_item_more.h" |
| 15 #include "ash/system/tray/tray_views.h" | 14 #include "ash/system/tray/tray_views.h" |
| 16 #include "base/logging.h" | 15 #include "base/logging.h" |
| 17 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 property_map_.clear(); | 115 property_map_.clear(); |
| 117 views::View* properties = new views::View; | 116 views::View* properties = new views::View; |
| 118 properties->SetLayoutManager(new views::BoxLayout( | 117 properties->SetLayoutManager(new views::BoxLayout( |
| 119 views::BoxLayout::kVertical, 0, 0, 1)); | 118 views::BoxLayout::kVertical, 0, 0, 1)); |
| 120 for (size_t i = 0; i < property_list.size(); i++) { | 119 for (size_t i = 0; i < property_list.size(); i++) { |
| 121 HoverHighlightView* container = new HoverHighlightView(this); | 120 HoverHighlightView* container = new HoverHighlightView(this); |
| 122 container->AddLabel( | 121 container->AddLabel( |
| 123 property_list[i].name, | 122 property_list[i].name, |
| 124 property_list[i].selected ? gfx::Font::BOLD : gfx::Font::NORMAL); | 123 property_list[i].selected ? gfx::Font::BOLD : gfx::Font::NORMAL); |
| 125 properties->AddChildView(container); | 124 properties->AddChildView(container); |
| 126 property_map_[container] = property_list[i]; | 125 property_map_[container] = property_list[i].key; |
| 127 } | 126 } |
| 128 properties->set_border(views::Border::CreateSolidSidedBorder( | 127 properties->set_border(views::Border::CreateSolidSidedBorder( |
| 129 0, 0, 1, 0, kBorderLightColor)); | 128 0, 0, 1, 0, kBorderLightColor)); |
| 130 AddChildView(properties); | 129 AddChildView(properties); |
| 131 } | 130 } |
| 132 | 131 |
| 133 void AppendSettings() { | 132 void AppendSettings() { |
| 134 HoverHighlightView* container = new HoverHighlightView(this); | 133 HoverHighlightView* container = new HoverHighlightView(this); |
| 135 container->AddLabel(ui::ResourceBundle::GetSharedInstance(). | 134 container->AddLabel(ui::ResourceBundle::GetSharedInstance(). |
| 136 GetLocalizedString(IDS_ASH_STATUS_TRAY_IME_SETTINGS), | 135 GetLocalizedString(IDS_ASH_STATUS_TRAY_IME_SETTINGS), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 147 } else if (sender == settings_) { | 146 } else if (sender == settings_) { |
| 148 delegate->ShowIMESettings(); | 147 delegate->ShowIMESettings(); |
| 149 } else { | 148 } else { |
| 150 std::map<views::View*, std::string>::const_iterator ime_find; | 149 std::map<views::View*, std::string>::const_iterator ime_find; |
| 151 ime_find = ime_map_.find(sender); | 150 ime_find = ime_map_.find(sender); |
| 152 if (ime_find != ime_map_.end()) { | 151 if (ime_find != ime_map_.end()) { |
| 153 std::string ime_id = ime_find->second; | 152 std::string ime_id = ime_find->second; |
| 154 delegate->SwitchIME(ime_id); | 153 delegate->SwitchIME(ime_id); |
| 155 GetWidget()->Close(); | 154 GetWidget()->Close(); |
| 156 } else { | 155 } else { |
| 157 std::map<views::View*, IMEPropertyInfo>::const_iterator prop_find; | 156 std::map<views::View*, std::string>::const_iterator prop_find; |
| 158 prop_find = property_map_.find(sender); | 157 prop_find = property_map_.find(sender); |
| 159 if (prop_find != property_map_.end()) { | 158 if (prop_find != property_map_.end()) { |
| 160 const IMEPropertyInfo& prop = prop_find->second; | 159 const std::string key = prop_find->second; |
| 161 delegate->ActivateIMEProperty(prop.key, prop.is_selection); | 160 delegate->ActivateIMEProperty(key); |
| 162 GetWidget()->Close(); | 161 GetWidget()->Close(); |
| 163 } | 162 } |
| 164 } | 163 } |
| 165 } | 164 } |
| 166 } | 165 } |
| 167 | 166 |
| 168 user::LoginStatus login_; | 167 user::LoginStatus login_; |
| 169 | 168 |
| 170 std::map<views::View*, std::string> ime_map_; | 169 std::map<views::View*, std::string> ime_map_; |
| 171 std::map<views::View*, IMEPropertyInfo> property_map_; | 170 std::map<views::View*, std::string> property_map_; |
| 172 views::View* header_; | 171 views::View* header_; |
| 173 views::View* settings_; | 172 views::View* settings_; |
| 174 | 173 |
| 175 DISALLOW_COPY_AND_ASSIGN(IMEDetailedView); | 174 DISALLOW_COPY_AND_ASSIGN(IMEDetailedView); |
| 176 }; | 175 }; |
| 177 | 176 |
| 178 } // namespace tray | 177 } // namespace tray |
| 179 | 178 |
| 180 TrayIME::TrayIME() { | 179 TrayIME::TrayIME() { |
| 181 } | 180 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 UpdateTrayLabel(current, list.size()); | 229 UpdateTrayLabel(current, list.size()); |
| 231 | 230 |
| 232 if (default_.get()) | 231 if (default_.get()) |
| 233 default_->UpdateLabel(current); | 232 default_->UpdateLabel(current); |
| 234 if (detailed_.get()) | 233 if (detailed_.get()) |
| 235 detailed_->Update(list, property_list); | 234 detailed_->Update(list, property_list); |
| 236 } | 235 } |
| 237 | 236 |
| 238 } // namespace internal | 237 } // namespace internal |
| 239 } // namespace ash | 238 } // namespace ash |
| OLD | NEW |