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

Side by Side Diff: ash/system/session/logout_button_tray.cc

Issue 2801583002: Use views::style for buttons, bootstrap ash_typography to do so. (Closed)
Patch Set: rebase for epic ash file move Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/session/logout_button_tray.h" 5 #include "ash/system/session/logout_button_tray.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/ash_typography.h"
10 #include "ash/public/cpp/shelf_types.h" 11 #include "ash/public/cpp/shelf_types.h"
11 #include "ash/resources/grit/ash_resources.h" 12 #include "ash/resources/grit/ash_resources.h"
12 #include "ash/resources/vector_icons/vector_icons.h" 13 #include "ash/resources/vector_icons/vector_icons.h"
13 #include "ash/shelf/wm_shelf_util.h" 14 #include "ash/shelf/wm_shelf_util.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "ash/system/session/logout_confirmation_controller.h" 16 #include "ash/system/session/logout_confirmation_controller.h"
16 #include "ash/system/tray/system_tray_controller.h" 17 #include "ash/system/tray/system_tray_controller.h"
17 #include "ash/system/tray/system_tray_notifier.h" 18 #include "ash/system/tray/system_tray_notifier.h"
18 #include "ash/system/tray/tray_constants.h" 19 #include "ash/system/tray/tray_constants.h"
19 #include "ash/system/tray/tray_utils.h" 20 #include "ash/system/tray/tray_utils.h"
(...skipping 11 matching lines...) Expand all
31 #include "ui/views/controls/button/md_text_button.h" 32 #include "ui/views/controls/button/md_text_button.h"
32 #include "ui/views/painter.h" 33 #include "ui/views/painter.h"
33 34
34 namespace ash { 35 namespace ash {
35 36
36 LogoutButtonTray::LogoutButtonTray(WmShelf* wm_shelf) 37 LogoutButtonTray::LogoutButtonTray(WmShelf* wm_shelf)
37 : TrayBackgroundView(wm_shelf, false), 38 : TrayBackgroundView(wm_shelf, false),
38 button_(nullptr), 39 button_(nullptr),
39 login_status_(LoginStatus::NOT_LOGGED_IN), 40 login_status_(LoginStatus::NOT_LOGGED_IN),
40 show_logout_button_in_tray_(false) { 41 show_logout_button_in_tray_(false) {
41 views::MdTextButton* button = 42 views::MdTextButton* button = views::MdTextButton::Create(
42 views::MdTextButton::Create(this, base::string16()); 43 this, base::string16(), CONTEXT_LAUNCHER_BUTTON);
43 button->SetProminent(true); 44 button->SetProminent(true);
44 button->SetBgColorOverride(gfx::kGoogleRed700); 45 button->SetBgColorOverride(gfx::kGoogleRed700);
45 // Base font size + 2 = 14.
46 // TODO(estade): should this 2 be shared with other tray views? See
47 // crbug.com/623987
48 button->AdjustFontSize(2);
49 button_ = button; 46 button_ = button;
50 47
51 // Since LogoutButtonTray has a red background and it is distinguished 48 // Since LogoutButtonTray has a red background and it is distinguished
52 // by itself, no separator is needed on its right side. 49 // by itself, no separator is needed on its right side.
53 set_separator_visibility(false); 50 set_separator_visibility(false);
54 tray_container()->AddChildView(button_); 51 tray_container()->AddChildView(button_);
55 Shell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this); 52 Shell::Get()->system_tray_notifier()->AddLogoutButtonObserver(this);
56 } 53 }
57 54
58 LogoutButtonTray::~LogoutButtonTray() { 55 LogoutButtonTray::~LogoutButtonTray() {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 button_->SetText(base::string16()); 120 button_->SetText(base::string16());
124 button_->SetAccessibleName(title); 121 button_->SetAccessibleName(title);
125 button_->SetImage(views::LabelButton::STATE_NORMAL, 122 button_->SetImage(views::LabelButton::STATE_NORMAL,
126 gfx::CreateVectorIcon(kShelfLogoutIcon, kTrayIconColor)); 123 gfx::CreateVectorIcon(kShelfLogoutIcon, kTrayIconColor));
127 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize)); 124 button_->SetMinSize(gfx::Size(kTrayItemSize, kTrayItemSize));
128 } 125 }
129 UpdateVisibility(); 126 UpdateVisibility();
130 } 127 }
131 128
132 } // namespace ash 129 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698