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

Side by Side Diff: ash/common/system/chromeos/ime_menu/ime_list_view.cc

Issue 2300353002: Revert of Make TrayDetailsView a ViewClickListener and ButtonListener (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/common/system/chromeos/ime_menu/ime_list_view.h" 5 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h"
6 6
7 #include "ash/common/system/tray/hover_highlight_view.h" 7 #include "ash/common/system/tray/hover_highlight_view.h"
8 #include "ash/common/system/tray/ime_info.h" 8 #include "ash/common/system/tray/ime_info.h"
9 #include "ash/common/system/tray/system_tray_delegate.h" 9 #include "ash/common/system/tray/system_tray_delegate.h"
10 #include "ash/common/system/tray/tray_constants.h" 10 #include "ash/common/system/tray/tray_constants.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 HoverHighlightView* container = new HoverHighlightView(this); 122 HoverHighlightView* container = new HoverHighlightView(this);
123 int id = keyboard::IsKeyboardEnabled() ? IDS_ASH_STATUS_TRAY_DISABLE_KEYBOARD 123 int id = keyboard::IsKeyboardEnabled() ? IDS_ASH_STATUS_TRAY_DISABLE_KEYBOARD
124 : IDS_ASH_STATUS_TRAY_ENABLE_KEYBOARD; 124 : IDS_ASH_STATUS_TRAY_ENABLE_KEYBOARD;
125 container->AddLabel( 125 container->AddLabel(
126 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(id), 126 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(id),
127 gfx::ALIGN_LEFT, false /* highlight */); 127 gfx::ALIGN_LEFT, false /* highlight */);
128 scroll_content()->AddChildView(container); 128 scroll_content()->AddChildView(container);
129 keyboard_status_ = container; 129 keyboard_status_ = container;
130 } 130 }
131 131
132 void ImeListView::HandleViewClicked(views::View* view) { 132 void ImeListView::OnViewClicked(views::View* sender) {
133 if (view == keyboard_status_) { 133 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
134 if (sender == keyboard_status_) {
134 WmShell::Get()->ToggleIgnoreExternalKeyboard(); 135 WmShell::Get()->ToggleIgnoreExternalKeyboard();
135 return; 136 } else {
137 std::map<views::View*, std::string>::const_iterator ime_find;
138 ime_find = ime_map_.find(sender);
139 if (ime_find != ime_map_.end()) {
140 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE);
141 std::string ime_id = ime_find->second;
142 delegate->SwitchIME(ime_id);
143 GetWidget()->Close();
144 } else {
145 std::map<views::View*, std::string>::const_iterator prop_find;
146 prop_find = property_map_.find(sender);
147 if (prop_find != property_map_.end()) {
148 const std::string key = prop_find->second;
149 delegate->ActivateIMEProperty(key);
150 GetWidget()->Close();
151 }
152 }
136 } 153 }
137
138 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
139 std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view);
140 if (ime != ime_map_.end()) {
141 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE);
142 std::string ime_id = ime->second;
143 delegate->SwitchIME(ime_id);
144 } else {
145 std::map<views::View*, std::string>::const_iterator property =
146 property_map_.find(view);
147 if (property == property_map_.end())
148 return;
149 const std::string key = property->second;
150 delegate->ActivateIMEProperty(key);
151 }
152
153 GetWidget()->Close();
154 } 154 }
155 155
156 } // namespace ash 156 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698