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

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
OLDNEW
(Empty)
1
oshima 2017/05/06 19:50:22 ditto
malaykeshav 2017/05/08 19:18:06 Done
2 // Copyright 2014 The Chromium Authors. All rights reserved.
oshima 2017/05/06 19:50:22 2017
malaykeshav 2017/05/08 19:18:06 Done
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #include "ash/system/display_scale/tray_scale.h"
7
8 #include "ash/ash_switches.h"
9 #include "ash/resources/vector_icons/vector_icons.h"
10 #include "ash/root_window_controller.h"
11 #include "ash/shell_port.h"
12 #include "ash/system/display_scale/scale_detailed_view.h"
13 #include "ash/system/display_scale/scale_view.h"
14 #include "ash/system/tray/system_tray.h"
15 #include "ash/system/tray/tray_constants.h"
16 #include "base/command_line.h"
17 #include "ui/views/view.h"
18
19 namespace ash {
20 namespace {
21
22 bool IsDisplayScaleTrayEnabled() {
23 return base::CommandLine::ForCurrentProcess()->HasSwitch(
24 switches::kAshEnableScaleSettingsTray);
25 }
26
27 } // namespace
28
29 TrayScale::TrayScale(SystemTray* system_tray)
30 : SystemTrayItem(system_tray, UMA_NOT_RECORDED) {}
31
32 TrayScale::~TrayScale() {}
33
34 views::View* TrayScale::CreateDefaultView(LoginStatus status) {
35 if (!IsDisplayScaleTrayEnabled())
36 return nullptr;
37 scale_view_ = new tray::ScaleView(this, true);
38 return scale_view_;
39 }
40
41 views::View* TrayScale::CreateDetailedView(LoginStatus status) {
42 if (!IsDisplayScaleTrayEnabled())
43 return nullptr;
44 scale_detail_view_ = new tray::ScaleDetailedView(this);
45 return scale_detail_view_;
46 }
47
48 void TrayScale::DestroyDefaultView() {
49 scale_view_ = nullptr;
50 }
51
52 void TrayScale::DestroyDetailedView() {
53 scale_detail_view_ = nullptr;
54 }
55
56 bool TrayScale::ShouldShowShelf() const {
57 return false;
58 }
59
60 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698