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

Side by Side Diff: ash/system/display_scale/tray_scale.cc

Issue 2855143004: Implements a display scale tray setting behind a chrome switch (Closed)
Patch Set: Sync with ToT Created 3 years, 7 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
« no previous file with comments | « ash/system/display_scale/tray_scale.h ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/system/display_scale/tray_scale.h"
6
7 #include "ash/ash_switches.h"
8 #include "ash/resources/vector_icons/vector_icons.h"
9 #include "ash/root_window_controller.h"
10 #include "ash/shell_port.h"
11 #include "ash/system/display_scale/scale_detailed_view.h"
12 #include "ash/system/display_scale/scale_view.h"
13 #include "ash/system/tray/system_tray.h"
14 #include "ash/system/tray/tray_constants.h"
15 #include "base/command_line.h"
16 #include "ui/views/view.h"
17
18 namespace ash {
19 namespace {
20
21 bool IsDisplayScaleTrayEnabled() {
22 return base::CommandLine::ForCurrentProcess()->HasSwitch(
23 switches::kAshEnableScaleSettingsTray);
24 }
25
26 } // namespace
27
28 TrayScale::TrayScale(SystemTray* system_tray)
29 : SystemTrayItem(system_tray, UMA_NOT_RECORDED) {}
30
31 TrayScale::~TrayScale() {}
32
33 views::View* TrayScale::CreateDefaultView(LoginStatus status) {
34 if (!IsDisplayScaleTrayEnabled())
35 return nullptr;
36 scale_view_ = new tray::ScaleView(this, true);
37 return scale_view_;
38 }
39
40 views::View* TrayScale::CreateDetailedView(LoginStatus status) {
41 if (!IsDisplayScaleTrayEnabled())
42 return nullptr;
43 scale_detail_view_ = new tray::ScaleDetailedView(this);
44 return scale_detail_view_;
45 }
46
47 void TrayScale::DestroyDefaultView() {
48 scale_view_ = nullptr;
49 }
50
51 void TrayScale::DestroyDetailedView() {
52 scale_detail_view_ = nullptr;
53 }
54
55 bool TrayScale::ShouldShowShelf() const {
56 return false;
57 }
58
59 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/display_scale/tray_scale.h ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698