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

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

Issue 2489883005: Fix a couple issues with sticky headers (Closed)
Patch Set: rebase 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
« no previous file with comments | « no previous file | ash/common/system/chromeos/network/network_list_md.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 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/ash_view_ids.h"
8 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/system/tray/hover_highlight_view.h" 8 #include "ash/common/system/tray/hover_highlight_view.h"
10 #include "ash/common/system/tray/ime_info.h" 9 #include "ash/common/system/tray/ime_info.h"
11 #include "ash/common/system/tray/system_menu_button.h" 10 #include "ash/common/system/tray/system_menu_button.h"
12 #include "ash/common/system/tray/system_tray_delegate.h" 11 #include "ash/common/system/tray/system_tray_delegate.h"
13 #include "ash/common/system/tray/tray_constants.h" 12 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/tray/tray_details_view.h" 13 #include "ash/common/system/tray/tray_details_view.h"
15 #include "ash/common/system/tray/tray_popup_header_button.h" 14 #include "ash/common/system/tray/tray_popup_header_button.h"
16 #include "ash/common/system/tray/tray_popup_item_style.h" 15 #include "ash/common/system/tray/tray_popup_item_style.h"
17 #include "ash/common/system/tray/tray_popup_utils.h" 16 #include "ash/common/system/tray/tray_popup_utils.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 int GetHeightForWidth(int w) const override { 195 int GetHeightForWidth(int w) const override {
197 return GetPreferredSize().height(); 196 return GetPreferredSize().height();
198 } 197 }
199 198
200 void OnNativeThemeChanged(const ui::NativeTheme* theme) override { 199 void OnNativeThemeChanged(const ui::NativeTheme* theme) override {
201 UpdateStyle(); 200 UpdateStyle();
202 } 201 }
203 202
204 private: 203 private:
205 void Init() { 204 void Init() {
205 TrayPopupUtils::ConfigureAsStickyHeader(this);
206 SetLayoutManager(new views::FillLayout); 206 SetLayoutManager(new views::FillLayout);
207 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
208 207
209 TriView* tri_view = TrayPopupUtils::CreateDefaultRowView(); 208 TriView* tri_view = TrayPopupUtils::CreateDefaultRowView();
210 AddChildView(tri_view); 209 AddChildView(tri_view);
211 210
212 // The on-screen keyboard image button. 211 // The on-screen keyboard image button.
213 views::ImageView* keyboard_image = TrayPopupUtils::CreateMainImageView(); 212 views::ImageView* keyboard_image = TrayPopupUtils::CreateMainImageView();
214 keyboard_image->SetImage(gfx::CreateVectorIcon( 213 keyboard_image->SetImage(gfx::CreateVectorIcon(
215 kImeMenuOnScreenKeyboardIcon, kMenuIconSize, kMenuIconColor)); 214 kImeMenuOnScreenKeyboardIcon, kMenuIconSize, kMenuIconColor));
216 tri_view->AddView(TriView::Container::START, keyboard_image); 215 tri_view->AddView(TriView::Container::START, keyboard_image);
217 216
218 // The on-screen keyboard label. 217 // The on-screen keyboard label.
219 label_ = TrayPopupUtils::CreateDefaultLabel(); 218 label_ = TrayPopupUtils::CreateDefaultLabel();
220 label_->SetText(ui::ResourceBundle::GetSharedInstance().GetLocalizedString( 219 label_->SetText(ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
221 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD)); 220 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD));
222 UpdateStyle(); 221 UpdateStyle();
223 tri_view->AddView(TriView::Container::CENTER, label_); 222 tri_view->AddView(TriView::Container::CENTER, label_);
224 223
225 // The on-screen keyboard toggle button. 224 // The on-screen keyboard toggle button.
226 toggle_ = new views::ToggleButton(listener_); 225 toggle_ = new views::ToggleButton(listener_);
227 toggle_->SetFocusForPlatform(); 226 toggle_->SetFocusForPlatform();
228 toggle_->SetTooltipText( 227 toggle_->SetTooltipText(
229 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( 228 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
230 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD)); 229 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD));
231 tri_view->AddView(TriView::Container::END, toggle_); 230 tri_view->AddView(TriView::Container::END, toggle_);
232
233 set_id(VIEW_ID_STICKY_HEADER);
234 } 231 }
235 232
236 // Updates the style of |label_| based on the current native theme. 233 // Updates the style of |label_| based on the current native theme.
237 void UpdateStyle() { 234 void UpdateStyle() {
238 TrayPopupItemStyle style( 235 TrayPopupItemStyle style(
239 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); 236 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
240 style.SetupLabel(label_); 237 style.SetupLabel(label_);
241 } 238 }
242 239
243 // ButtonListener to notify when |toggle_| is clicked. 240 // ButtonListener to notify when |toggle_| is clicked.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 408 }
412 409
413 void ImeListView::HandleButtonPressed(views::Button* sender, 410 void ImeListView::HandleButtonPressed(views::Button* sender,
414 const ui::Event& event) { 411 const ui::Event& event) {
415 DCHECK(material_keyboard_status_view_); 412 DCHECK(material_keyboard_status_view_);
416 DCHECK_EQ(sender, material_keyboard_status_view_->toggle()); 413 DCHECK_EQ(sender, material_keyboard_status_view_->toggle());
417 WmShell::Get()->ToggleIgnoreExternalKeyboard(); 414 WmShell::Get()->ToggleIgnoreExternalKeyboard();
418 } 415 }
419 416
420 } // namespace ash 417 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/chromeos/network/network_list_md.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698