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

Side by Side Diff: ash/common/system/ime/tray_ime_chromeos.cc

Issue 2497813002: Modify Ash MD system menu layout for title rows (Closed)
Patch Set: trybots Created 4 years, 1 month 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 (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/common/system/ime/tray_ime_chromeos.h" 5 #include "ash/common/system/ime/tray_ime_chromeos.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/common/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
11 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" 11 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h"
12 #include "ash/common/system/tray/hover_highlight_view.h" 12 #include "ash/common/system/tray/hover_highlight_view.h"
13 #include "ash/common/system/tray/system_tray.h" 13 #include "ash/common/system/tray/system_tray.h"
14 #include "ash/common/system/tray/system_tray_controller.h" 14 #include "ash/common/system/tray/system_tray_controller.h"
15 #include "ash/common/system/tray/system_tray_delegate.h" 15 #include "ash/common/system/tray/system_tray_delegate.h"
16 #include "ash/common/system/tray/system_tray_notifier.h" 16 #include "ash/common/system/tray/system_tray_notifier.h"
17 #include "ash/common/system/tray/tray_constants.h" 17 #include "ash/common/system/tray/tray_constants.h"
18 #include "ash/common/system/tray/tray_details_view.h" 18 #include "ash/common/system/tray/tray_details_view.h"
19 #include "ash/common/system/tray/tray_item_more.h" 19 #include "ash/common/system/tray/tray_item_more.h"
20 #include "ash/common/system/tray/tray_item_view.h" 20 #include "ash/common/system/tray/tray_item_view.h"
21 #include "ash/common/system/tray/tray_popup_item_style.h" 21 #include "ash/common/system/tray/tray_popup_item_style.h"
22 #include "ash/common/system/tray/tray_popup_utils.h" 22 #include "ash/common/system/tray/tray_popup_utils.h"
23 #include "ash/common/system/tray/tray_utils.h" 23 #include "ash/common/system/tray/tray_utils.h"
24 #include "ash/common/system/tray/tri_view.h"
24 #include "ash/common/system/tray_accessibility.h" 25 #include "ash/common/system/tray_accessibility.h"
25 #include "ash/common/wm_shell.h" 26 #include "ash/common/wm_shell.h"
26 #include "ash/resources/vector_icons/vector_icons.h" 27 #include "ash/resources/vector_icons/vector_icons.h"
27 #include "base/logging.h" 28 #include "base/logging.h"
28 #include "base/strings/utf_string_conversions.h" 29 #include "base/strings/utf_string_conversions.h"
29 #include "grit/ash_resources.h" 30 #include "grit/ash_resources.h"
30 #include "grit/ash_strings.h" 31 #include "grit/ash_strings.h"
31 #include "ui/accessibility/ax_enums.h" 32 #include "ui/accessibility/ax_enums.h"
32 #include "ui/accessibility/ax_node_data.h" 33 #include "ui/accessibility/ax_node_data.h"
33 #include "ui/base/resource/resource_bundle.h" 34 #include "ui/base/resource/resource_bundle.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ShowSettings(); 151 ShowSettings();
151 } 152 }
152 153
153 void HandleButtonPressed(views::Button* sender, 154 void HandleButtonPressed(views::Button* sender,
154 const ui::Event& event) override { 155 const ui::Event& event) override {
155 if (sender == settings_button_) 156 if (sender == settings_button_)
156 ShowSettings(); 157 ShowSettings();
157 } 158 }
158 159
159 void CreateExtraTitleRowButtons() override { 160 void CreateExtraTitleRowButtons() override {
160 if (MaterialDesignController::IsSystemTrayMenuMaterial()) 161 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
161 settings_button_ = title_row()->AddSettingsButton(this, login_); 162 // It is possible that the settings button has already been created
163 // through a previous call to Update().
164 if (settings_button_)
165 return;
166
167 tri_view()->SetContainerVisible(TriView::Container::END, true);
168 settings_button_ = CreateSettingsButton(login_);
169 tri_view()->AddView(TriView::Container::END, settings_button_);
170 }
162 } 171 }
163 172
164 void AppendSettings() { 173 void AppendSettings() {
165 HoverHighlightView* container = new HoverHighlightView(this); 174 HoverHighlightView* container = new HoverHighlightView(this);
166 container->AddLabel( 175 container->AddLabel(
167 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( 176 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
168 IDS_ASH_STATUS_TRAY_IME_SETTINGS), 177 IDS_ASH_STATUS_TRAY_IME_SETTINGS),
169 gfx::ALIGN_LEFT, false /* highlight */); 178 gfx::ALIGN_LEFT, false /* highlight */);
170 AddChildView(container); 179 AddChildView(container);
171 settings_ = container; 180 settings_ = container;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 else 342 else
334 Update(); 343 Update();
335 } 344 }
336 345
337 bool TrayIME::ShouldDefaultViewBeVisible() { 346 bool TrayIME::ShouldDefaultViewBeVisible() {
338 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 || 347 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 ||
339 ShouldShowKeyboardToggle()); 348 ShouldShowKeyboardToggle());
340 } 349 }
341 350
342 } // namespace ash 351 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/network/network_state_list_detailed_view.cc ('k') | ash/common/system/tray/special_popup_row.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698