OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/logout_button/logout_button_tray.h" | 5 #include "ash/system/logout_button/logout_button_tray.h" |
6 | 6 |
7 #include "ash/shelf/shelf_types.h" | 7 #include "ash/shelf/shelf_types.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/status_area_widget.h" | 9 #include "ash/system/status_area_widget.h" |
10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
11 #include "ash/system/tray/system_tray_notifier.h" | 11 #include "ash/system/tray/system_tray_notifier.h" |
12 #include "ash/system/tray/tray_constants.h" | 12 #include "ash/system/tray/tray_constants.h" |
13 #include "ash/system/tray/tray_utils.h" | 13 #include "ash/system/tray/tray_utils.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "grit/ash_resources.h" | 15 #include "grit/ash_resources.h" |
16 #include "third_party/skia/include/core/SkColor.h" | 16 #include "third_party/skia/include/core/SkColor.h" |
17 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
18 #include "ui/gfx/font_list.h" | 18 #include "ui/gfx/geometry/insets.h" |
19 #include "ui/gfx/insets.h" | 19 #include "ui/gfx/geometry/size.h" |
20 #include "ui/gfx/size.h" | |
21 #include "ui/views/bubble/tray_bubble_view.h" | 20 #include "ui/views/bubble/tray_bubble_view.h" |
22 #include "ui/views/controls/button/label_button.h" | 21 #include "ui/views/controls/button/label_button.h" |
23 #include "ui/views/controls/button/label_button_border.h" | 22 #include "ui/views/controls/button/label_button_border.h" |
24 #include "ui/views/painter.h" | 23 #include "ui/views/painter.h" |
25 | 24 |
26 namespace ash { | 25 namespace ash { |
27 namespace internal { | 26 namespace internal { |
28 | 27 |
29 namespace { | 28 namespace { |
30 | 29 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 75 |
77 private: | 76 private: |
78 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationDialogDelegate); | 77 DISALLOW_COPY_AND_ASSIGN(LogoutConfirmationDialogDelegate); |
79 }; | 78 }; |
80 | 79 |
81 } // namespace | 80 } // namespace |
82 | 81 |
83 LogoutButton::LogoutButton(views::ButtonListener* listener) | 82 LogoutButton::LogoutButton(views::ButtonListener* listener) |
84 : views::LabelButton(listener, base::string16()) { | 83 : views::LabelButton(listener, base::string16()) { |
85 SetupLabelForTray(label()); | 84 SetupLabelForTray(label()); |
86 SetFontList( | |
87 GetFontList().DeriveFontListWithSizeDeltaAndStyle(0, gfx::Font::NORMAL)); | |
88 for (size_t state = 0; state < views::Button::STATE_COUNT; ++state) | 85 for (size_t state = 0; state < views::Button::STATE_COUNT; ++state) |
89 SetTextColor(static_cast<views::Button::ButtonState>(state), SK_ColorWHITE); | 86 SetTextColor(static_cast<views::Button::ButtonState>(state), SK_ColorWHITE); |
90 | 87 |
91 scoped_ptr<views::LabelButtonBorder> border( | 88 scoped_ptr<views::LabelButtonBorder> border( |
92 new views::LabelButtonBorder(views::Button::STYLE_TEXTBUTTON)); | 89 new views::LabelButtonBorder(views::Button::STYLE_TEXTBUTTON)); |
93 border->SetPainter(false, views::Button::STATE_NORMAL, | 90 border->SetPainter(false, views::Button::STATE_NORMAL, |
94 views::Painter::CreateImageGridPainter(kLogoutButtonNormalImages)); | 91 views::Painter::CreateImageGridPainter(kLogoutButtonNormalImages)); |
95 border->SetPainter(false, views::Button::STATE_HOVERED, | 92 border->SetPainter(false, views::Button::STATE_HOVERED, |
96 views::Painter::CreateImageGridPainter(kLogoutButtonNormalImages)); | 93 views::Painter::CreateImageGridPainter(kLogoutButtonNormalImages)); |
97 border->SetPainter(false, views::Button::STATE_PRESSED, | 94 border->SetPainter(false, views::Button::STATE_PRESSED, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 void LogoutButtonTray::UpdateVisibility() { | 224 void LogoutButtonTray::UpdateVisibility() { |
228 SetVisible(show_logout_button_in_tray_ && | 225 SetVisible(show_logout_button_in_tray_ && |
229 login_status_ != user::LOGGED_IN_NONE && | 226 login_status_ != user::LOGGED_IN_NONE && |
230 login_status_ != user::LOGGED_IN_LOCKED); | 227 login_status_ != user::LOGGED_IN_LOCKED); |
231 if (!show_logout_button_in_tray_) | 228 if (!show_logout_button_in_tray_) |
232 EnsureConfirmationDialogIsClosed(); | 229 EnsureConfirmationDialogIsClosed(); |
233 } | 230 } |
234 | 231 |
235 } // namespace internal | 232 } // namespace internal |
236 } // namespace ash | 233 } // namespace ash |
OLD | NEW |