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

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

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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/chromeos/session/logout_button_tray.h" 5 #include "ash/system/chromeos/session/logout_button_tray.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "ash/shelf/shelf_types.h" 10 #include "ash/shelf/shelf_types.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/system/chromeos/session/logout_confirmation_controller.h" 12 #include "ash/system/chromeos/session/logout_confirmation_controller.h"
12 #include "ash/system/status_area_widget.h" 13 #include "ash/system/status_area_widget.h"
13 #include "ash/system/tray/system_tray_delegate.h" 14 #include "ash/system/tray/system_tray_delegate.h"
14 #include "ash/system/tray/system_tray_notifier.h" 15 #include "ash/system/tray/system_tray_notifier.h"
15 #include "ash/system/tray/tray_constants.h" 16 #include "ash/system/tray/tray_constants.h"
16 #include "ash/system/tray/tray_utils.h" 17 #include "ash/system/tray/tray_utils.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h"
19 #include "grit/ash_resources.h" 19 #include "grit/ash_resources.h"
20 #include "third_party/skia/include/core/SkColor.h" 20 #include "third_party/skia/include/core/SkColor.h"
21 #include "ui/events/event.h" 21 #include "ui/events/event.h"
22 #include "ui/gfx/geometry/insets.h" 22 #include "ui/gfx/geometry/insets.h"
23 #include "ui/gfx/geometry/size.h" 23 #include "ui/gfx/geometry/size.h"
24 #include "ui/views/bubble/tray_bubble_view.h" 24 #include "ui/views/bubble/tray_bubble_view.h"
25 #include "ui/views/controls/button/label_button.h" 25 #include "ui/views/controls/button/label_button.h"
26 #include "ui/views/controls/button/label_button_border.h" 26 #include "ui/views/controls/button/label_button_border.h"
27 #include "ui/views/painter.h" 27 #include "ui/views/painter.h"
28 28
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 } // namespace 67 } // namespace
68 68
69 LogoutButton::LogoutButton(views::ButtonListener* listener) 69 LogoutButton::LogoutButton(views::ButtonListener* listener)
70 : views::LabelButton(listener, base::string16()) { 70 : views::LabelButton(listener, base::string16()) {
71 SetupLabelForTray(label()); 71 SetupLabelForTray(label());
72 SetFontList(label()->font_list()); 72 SetFontList(label()->font_list());
73 for (size_t state = 0; state < views::Button::STATE_COUNT; ++state) 73 for (size_t state = 0; state < views::Button::STATE_COUNT; ++state)
74 SetTextColor(static_cast<views::Button::ButtonState>(state), SK_ColorWHITE); 74 SetTextColor(static_cast<views::Button::ButtonState>(state), SK_ColorWHITE);
75 75
76 scoped_ptr<views::LabelButtonAssetBorder> border( 76 std::unique_ptr<views::LabelButtonAssetBorder> border(
77 new views::LabelButtonAssetBorder(views::Button::STYLE_TEXTBUTTON)); 77 new views::LabelButtonAssetBorder(views::Button::STYLE_TEXTBUTTON));
78 border->SetPainter(false, views::Button::STATE_NORMAL, 78 border->SetPainter(false, views::Button::STATE_NORMAL,
79 views::Painter::CreateImageGridPainter(kLogoutButtonNormalImages)); 79 views::Painter::CreateImageGridPainter(kLogoutButtonNormalImages));
80 border->SetPainter(false, views::Button::STATE_HOVERED, 80 border->SetPainter(false, views::Button::STATE_HOVERED,
81 views::Painter::CreateImageGridPainter(kLogoutButtonNormalImages)); 81 views::Painter::CreateImageGridPainter(kLogoutButtonNormalImages));
82 border->SetPainter(false, views::Button::STATE_PRESSED, 82 border->SetPainter(false, views::Button::STATE_PRESSED,
83 views::Painter::CreateImageGridPainter(kLogoutButtonPushedImages)); 83 views::Painter::CreateImageGridPainter(kLogoutButtonPushedImages));
84 gfx::Insets insets = border->GetInsets(); 84 gfx::Insets insets = border->GetInsets();
85 insets += gfx::Insets(0, kLogoutButtonHorizontalExtraPadding, 85 insets += gfx::Insets(0, kLogoutButtonHorizontalExtraPadding,
86 0, kLogoutButtonHorizontalExtraPadding); 86 0, kLogoutButtonHorizontalExtraPadding);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 UpdateVisibility(); 158 UpdateVisibility();
159 } 159 }
160 160
161 void LogoutButtonTray::UpdateVisibility() { 161 void LogoutButtonTray::UpdateVisibility() {
162 SetVisible(show_logout_button_in_tray_ && 162 SetVisible(show_logout_button_in_tray_ &&
163 login_status_ != user::LOGGED_IN_NONE && 163 login_status_ != user::LOGGED_IN_NONE &&
164 login_status_ != user::LOGGED_IN_LOCKED); 164 login_status_ != user::LOGGED_IN_LOCKED);
165 } 165 }
166 166
167 } // namespace ash 167 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698