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

Side by Side Diff: ash/common/system/tray/system_tray_controller.cc

Issue 2395523002: chromeos: Refactor system tray "show settings" commands to use mojo (Closed)
Patch Set: Created 4 years, 2 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/tray/system_tray_controller.h" 5 #include "ash/common/system/tray/system_tray_controller.h"
6 6
7 #include "ash/common/system/tray/system_tray_notifier.h" 7 #include "ash/common/system/tray/system_tray_notifier.h"
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "services/shell/public/cpp/connector.h" 11 #include "services/shell/public/cpp/connector.h"
12 12
13 namespace ash { 13 namespace ash {
14 14
15 SystemTrayController::SystemTrayController(shell::Connector* connector) 15 SystemTrayController::SystemTrayController(shell::Connector* connector)
16 : connector_(connector), hour_clock_type_(base::GetHourClockType()) {} 16 : connector_(connector), hour_clock_type_(base::GetHourClockType()) {}
17 17
18 SystemTrayController::~SystemTrayController() {} 18 SystemTrayController::~SystemTrayController() {}
19 19
20 void SystemTrayController::ShowSettings() {
21 if (ConnectToSystemTrayClient())
22 system_tray_client_->ShowSettings();
23 }
24
20 void SystemTrayController::ShowDateSettings() { 25 void SystemTrayController::ShowDateSettings() {
21 if (ConnectToSystemTrayClient()) 26 if (ConnectToSystemTrayClient())
22 system_tray_client_->ShowDateSettings(); 27 system_tray_client_->ShowDateSettings();
23 } 28 }
24 29
30 void SystemTrayController::ShowDisplaySettings() {
31 if (ConnectToSystemTrayClient())
32 system_tray_client_->ShowDisplaySettings();
33 }
34
35 void SystemTrayController::ShowPowerSettings() {
36 if (ConnectToSystemTrayClient())
37 system_tray_client_->ShowPowerSettings();
38 }
39
40 void SystemTrayController::ShowChromeSlow() {
41 if (ConnectToSystemTrayClient())
42 system_tray_client_->ShowChromeSlow();
43 }
44
45 void SystemTrayController::ShowIMESettings() {
46 if (ConnectToSystemTrayClient())
47 system_tray_client_->ShowIMESettings();
48 }
49
50 void SystemTrayController::ShowHelp() {
51 if (ConnectToSystemTrayClient())
52 system_tray_client_->ShowHelp();
53 }
54
55 void SystemTrayController::ShowAccessibilityHelp() {
56 if (ConnectToSystemTrayClient())
57 system_tray_client_->ShowAccessibilityHelp();
58 }
59
60 void SystemTrayController::ShowAccessibilitySettings() {
61 if (ConnectToSystemTrayClient())
62 system_tray_client_->ShowAccessibilitySettings();
63 }
64
65 void SystemTrayController::ShowPaletteHelp() {
66 if (ConnectToSystemTrayClient())
67 system_tray_client_->ShowPaletteHelp();
68 }
69
70 void SystemTrayController::ShowPaletteSettings() {
71 if (ConnectToSystemTrayClient())
72 system_tray_client_->ShowPaletteSettings();
73 }
74
75 void SystemTrayController::ShowPublicAccountInfo() {
76 if (ConnectToSystemTrayClient())
77 system_tray_client_->ShowPublicAccountInfo();
78 }
79
80 void SystemTrayController::ShowProxySettings() {
81 if (ConnectToSystemTrayClient())
82 system_tray_client_->ShowProxySettings();
83 }
84
25 void SystemTrayController::BindRequest(mojom::SystemTrayRequest request) { 85 void SystemTrayController::BindRequest(mojom::SystemTrayRequest request) {
26 bindings_.AddBinding(this, std::move(request)); 86 bindings_.AddBinding(this, std::move(request));
27 } 87 }
28 88
29 bool SystemTrayController::ConnectToSystemTrayClient() { 89 bool SystemTrayController::ConnectToSystemTrayClient() {
30 // Unit tests may not have a connector. 90 // Unit tests may not have a connector.
31 if (!connector_) 91 if (!connector_)
32 return false; 92 return false;
33 93
34 #if defined(OS_CHROMEOS) 94 #if defined(OS_CHROMEOS)
(...skipping 21 matching lines...) Expand all
56 void SystemTrayController::OnClientConnectionError() { 116 void SystemTrayController::OnClientConnectionError() {
57 system_tray_client_.reset(); 117 system_tray_client_.reset();
58 } 118 }
59 119
60 void SystemTrayController::SetUse24HourClock(bool use_24_hour) { 120 void SystemTrayController::SetUse24HourClock(bool use_24_hour) {
61 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock; 121 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock;
62 WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged(); 122 WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged();
63 } 123 }
64 124
65 } // namespace ash 125 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698