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

Side by Side Diff: ash/common/system/chromeos/palette/palette_tray.cc

Issue 2761063002: Move more from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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 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/palette/palette_tray.h" 5 #include "ash/common/system/chromeos/palette/palette_tray.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/session/session_controller.h" 8 #include "ash/common/session/session_controller.h"
9 #include "ash/common/shelf/shelf_constants.h" 9 #include "ash/common/shelf/shelf_constants.h"
10 #include "ash/common/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // Color of the separator. 61 // Color of the separator.
62 const SkColor kPaletteSeparatorColor = SkColorSetARGB(0x1E, 0x00, 0x00, 0x00); 62 const SkColor kPaletteSeparatorColor = SkColorSetARGB(0x1E, 0x00, 0x00, 0x00);
63 63
64 // Returns true if we are in a user session that can show the stylus tools. 64 // Returns true if we are in a user session that can show the stylus tools.
65 bool IsInUserSession() { 65 bool IsInUserSession() {
66 SessionController* session_controller = WmShell::Get()->session_controller(); 66 SessionController* session_controller = WmShell::Get()->session_controller();
67 return !session_controller->IsUserSessionBlocked() && 67 return !session_controller->IsUserSessionBlocked() &&
68 session_controller->GetSessionState() == 68 session_controller->GetSessionState() ==
69 session_manager::SessionState::ACTIVE && 69 session_manager::SessionState::ACTIVE &&
70 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != 70 Shell::Get()->system_tray_delegate()->GetUserLoginStatus() !=
71 LoginStatus::KIOSK_APP; 71 LoginStatus::KIOSK_APP;
72 } 72 }
73 73
74 class TitleView : public views::View, public views::ButtonListener { 74 class TitleView : public views::View, public views::ButtonListener {
75 public: 75 public:
76 explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) { 76 explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) {
77 // TODO(tdanderson|jdufault): Use TriView to handle the layout of the title. 77 // TODO(tdanderson|jdufault): Use TriView to handle the layout of the title.
78 // See crbug.com/614453. 78 // See crbug.com/614453.
79 auto* box_layout = 79 auto* box_layout =
80 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); 80 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 ~TitleView() override {} 120 ~TitleView() override {}
121 121
122 private: 122 private:
123 // views::ButtonListener: 123 // views::ButtonListener:
124 void ButtonPressed(views::Button* sender, const ui::Event& event) override { 124 void ButtonPressed(views::Button* sender, const ui::Event& event) override {
125 if (sender == settings_button_) { 125 if (sender == settings_button_) {
126 palette_tray_->RecordPaletteOptionsUsage( 126 palette_tray_->RecordPaletteOptionsUsage(
127 PaletteTrayOptions::PALETTE_SETTINGS_BUTTON); 127 PaletteTrayOptions::PALETTE_SETTINGS_BUTTON);
128 WmShell::Get()->system_tray_controller()->ShowPaletteSettings(); 128 Shell::Get()->system_tray_controller()->ShowPaletteSettings();
129 palette_tray_->HidePalette(); 129 palette_tray_->HidePalette();
130 } else if (sender == help_button_) { 130 } else if (sender == help_button_) {
131 palette_tray_->RecordPaletteOptionsUsage( 131 palette_tray_->RecordPaletteOptionsUsage(
132 PaletteTrayOptions::PALETTE_HELP_BUTTON); 132 PaletteTrayOptions::PALETTE_HELP_BUTTON);
133 WmShell::Get()->system_tray_controller()->ShowPaletteHelp(); 133 Shell::Get()->system_tray_controller()->ShowPaletteHelp();
134 palette_tray_->HidePalette(); 134 palette_tray_->HidePalette();
135 } else { 135 } else {
136 NOTREACHED(); 136 NOTREACHED();
137 } 137 }
138 } 138 }
139 139
140 // Unowned pointers to button views so we can determine which button was 140 // Unowned pointers to button views so we can determine which button was
141 // clicked. 141 // clicked.
142 views::View* settings_button_; 142 views::View* settings_button_;
143 views::View* help_button_; 143 views::View* help_button_;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 UpdateIconVisibility(); 423 UpdateIconVisibility();
424 } 424 }
425 } 425 }
426 426
427 void PaletteTray::UpdateIconVisibility() { 427 void PaletteTray::UpdateIconVisibility() {
428 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && 428 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() &&
429 IsInUserSession()); 429 IsInUserSession());
430 } 430 }
431 431
432 } // namespace ash 432 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/network/vpn_list_view.cc ('k') | ash/common/system/chromeos/power/dual_role_notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698