Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: ash/system/ime/tray_ime.cc

Issue 10008043: Allow non-radio button properties in uber tray. Simplified chinese will use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/shell.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
7 #include <vector> 8 #include <vector>
8 9
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/system/tray/system_tray.h" 11 #include "ash/system/tray/system_tray.h"
11 #include "ash/system/tray/system_tray_delegate.h" 12 #include "ash/system/tray/system_tray_delegate.h"
12 #include "ash/system/tray/tray_constants.h" 13 #include "ash/system/tray/tray_constants.h"
13 #include "ash/system/tray/tray_item_more.h" 14 #include "ash/system/tray/tray_item_more.h"
14 #include "ash/system/tray/tray_views.h" 15 #include "ash/system/tray/tray_views.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 property_map_.clear(); 116 property_map_.clear();
116 views::View* properties = new views::View; 117 views::View* properties = new views::View;
117 properties->SetLayoutManager(new views::BoxLayout( 118 properties->SetLayoutManager(new views::BoxLayout(
118 views::BoxLayout::kVertical, 0, 0, 1)); 119 views::BoxLayout::kVertical, 0, 0, 1));
119 for (size_t i = 0; i < property_list.size(); i++) { 120 for (size_t i = 0; i < property_list.size(); i++) {
120 HoverHighlightView* container = new HoverHighlightView(this); 121 HoverHighlightView* container = new HoverHighlightView(this);
121 container->AddLabel( 122 container->AddLabel(
122 property_list[i].name, 123 property_list[i].name,
123 property_list[i].selected ? gfx::Font::BOLD : gfx::Font::NORMAL); 124 property_list[i].selected ? gfx::Font::BOLD : gfx::Font::NORMAL);
124 properties->AddChildView(container); 125 properties->AddChildView(container);
125 property_map_[container] = property_list[i].key; 126 property_map_[container] = property_list[i];
126 } 127 }
127 properties->set_border(views::Border::CreateSolidSidedBorder( 128 properties->set_border(views::Border::CreateSolidSidedBorder(
128 0, 0, 1, 0, kBorderLightColor)); 129 0, 0, 1, 0, kBorderLightColor));
129 AddChildView(properties); 130 AddChildView(properties);
130 } 131 }
131 132
132 void AppendSettings() { 133 void AppendSettings() {
133 HoverHighlightView* container = new HoverHighlightView(this); 134 HoverHighlightView* container = new HoverHighlightView(this);
134 container->AddLabel(ui::ResourceBundle::GetSharedInstance(). 135 container->AddLabel(ui::ResourceBundle::GetSharedInstance().
135 GetLocalizedString(IDS_ASH_STATUS_TRAY_IME_SETTINGS), 136 GetLocalizedString(IDS_ASH_STATUS_TRAY_IME_SETTINGS),
(...skipping 10 matching lines...) Expand all
146 } else if (sender == settings_) { 147 } else if (sender == settings_) {
147 delegate->ShowIMESettings(); 148 delegate->ShowIMESettings();
148 } else { 149 } else {
149 std::map<views::View*, std::string>::const_iterator ime_find; 150 std::map<views::View*, std::string>::const_iterator ime_find;
150 ime_find = ime_map_.find(sender); 151 ime_find = ime_map_.find(sender);
151 if (ime_find != ime_map_.end()) { 152 if (ime_find != ime_map_.end()) {
152 std::string ime_id = ime_find->second; 153 std::string ime_id = ime_find->second;
153 delegate->SwitchIME(ime_id); 154 delegate->SwitchIME(ime_id);
154 GetWidget()->Close(); 155 GetWidget()->Close();
155 } else { 156 } else {
156 std::map<views::View*, std::string>::const_iterator prop_find; 157 std::map<views::View*, IMEPropertyInfo>::const_iterator prop_find;
157 prop_find = property_map_.find(sender); 158 prop_find = property_map_.find(sender);
158 if (prop_find != property_map_.end()) { 159 if (prop_find != property_map_.end()) {
159 std::string key = prop_find->second; 160 const IMEPropertyInfo& prop = prop_find->second;
160 delegate->ActivateIMEProperty(key); 161 delegate->ActivateIMEProperty(prop.key, prop.is_selection);
161 GetWidget()->Close(); 162 GetWidget()->Close();
162 } 163 }
163 } 164 }
164 } 165 }
165 } 166 }
166 167
167 user::LoginStatus login_; 168 user::LoginStatus login_;
168 169
169 std::map<views::View*, std::string> ime_map_; 170 std::map<views::View*, std::string> ime_map_;
170 std::map<views::View*, std::string> property_map_; 171 std::map<views::View*, IMEPropertyInfo> property_map_;
171 views::View* header_; 172 views::View* header_;
172 views::View* settings_; 173 views::View* settings_;
173 174
174 DISALLOW_COPY_AND_ASSIGN(IMEDetailedView); 175 DISALLOW_COPY_AND_ASSIGN(IMEDetailedView);
175 }; 176 };
176 177
177 } // namespace tray 178 } // namespace tray
178 179
179 TrayIME::TrayIME() { 180 TrayIME::TrayIME() {
180 } 181 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 UpdateTrayLabel(current, list.size()); 230 UpdateTrayLabel(current, list.size());
230 231
231 if (default_.get()) 232 if (default_.get())
232 default_->UpdateLabel(current); 233 default_->UpdateLabel(current);
233 if (detailed_.get()) 234 if (detailed_.get())
234 detailed_->Update(list, property_list); 235 detailed_->Update(list, property_list);
235 } 236 }
236 237
237 } // namespace internal 238 } // namespace internal
238 } // namespace ash 239 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698