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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/display_scale/tray_scale.cc
diff --git a/ash/system/display_scale/tray_scale.cc b/ash/system/display_scale/tray_scale.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7508f304d8a608be57c4a6fc8e443fed1cb0726b
--- /dev/null
+++ b/ash/system/display_scale/tray_scale.cc
@@ -0,0 +1,60 @@
+
oshima 2017/05/06 19:50:22 ditto
malaykeshav 2017/05/08 19:18:06 Done
+// Copyright 2014 The Chromium Authors. All rights reserved.
oshima 2017/05/06 19:50:22 2017
malaykeshav 2017/05/08 19:18:06 Done
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/system/display_scale/tray_scale.h"
+
+#include "ash/ash_switches.h"
+#include "ash/resources/vector_icons/vector_icons.h"
+#include "ash/root_window_controller.h"
+#include "ash/shell_port.h"
+#include "ash/system/display_scale/scale_detailed_view.h"
+#include "ash/system/display_scale/scale_view.h"
+#include "ash/system/tray/system_tray.h"
+#include "ash/system/tray/tray_constants.h"
+#include "base/command_line.h"
+#include "ui/views/view.h"
+
+namespace ash {
+namespace {
+
+bool IsDisplayScaleTrayEnabled() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshEnableScaleSettingsTray);
+}
+
+} // namespace
+
+TrayScale::TrayScale(SystemTray* system_tray)
+ : SystemTrayItem(system_tray, UMA_NOT_RECORDED) {}
+
+TrayScale::~TrayScale() {}
+
+views::View* TrayScale::CreateDefaultView(LoginStatus status) {
+ if (!IsDisplayScaleTrayEnabled())
+ return nullptr;
+ scale_view_ = new tray::ScaleView(this, true);
+ return scale_view_;
+}
+
+views::View* TrayScale::CreateDetailedView(LoginStatus status) {
+ if (!IsDisplayScaleTrayEnabled())
+ return nullptr;
+ scale_detail_view_ = new tray::ScaleDetailedView(this);
+ return scale_detail_view_;
+}
+
+void TrayScale::DestroyDefaultView() {
+ scale_view_ = nullptr;
+}
+
+void TrayScale::DestroyDetailedView() {
+ scale_detail_view_ = nullptr;
+}
+
+bool TrayScale::ShouldShowShelf() const {
+ return false;
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698