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

Unified Diff: ash/mus/system_tray_delegate_mus.cc

Issue 2381753002: Use mojo SystemTray interfaces for both mash and classic ash (Closed)
Patch Set: rebase again 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/mus/system_tray_delegate_mus.h ('k') | ash/mus/window_manager_application.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/system_tray_delegate_mus.cc
diff --git a/ash/mus/system_tray_delegate_mus.cc b/ash/mus/system_tray_delegate_mus.cc
index 3ea15c2eaec0d22116c23aae16742d52ca51b87e..b1ab43f0d674012e79fd005ed1dc5411f0de4fbf 100644
--- a/ash/mus/system_tray_delegate_mus.cc
+++ b/ash/mus/system_tray_delegate_mus.cc
@@ -5,20 +5,11 @@
#include "ash/mus/system_tray_delegate_mus.h"
#include "ash/common/system/networking_config_delegate.h"
-#include "ash/common/system/tray/system_tray_notifier.h"
-#include "ash/common/wm_shell.h"
#include "ash/mus/vpn_delegate_mus.h"
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/i18n/time_formatting.h"
-#include "base/logging.h"
-#include "services/shell/public/cpp/connector.h"
namespace ash {
namespace {
-SystemTrayDelegateMus* g_instance = nullptr;
-
// TODO(mash): Provide a real implementation, perhaps by folding its behavior
// into an ash-side network information cache. http://crbug.com/651157
class StubNetworkingConfigDelegate : public NetworkingConfigDelegate {
@@ -38,111 +29,11 @@ class StubNetworkingConfigDelegate : public NetworkingConfigDelegate {
} // namespace
-SystemTrayDelegateMus::SystemTrayDelegateMus(shell::Connector* connector)
- : connector_(connector),
- hour_clock_type_(base::GetHourClockType()),
- networking_config_delegate_(new StubNetworkingConfigDelegate),
- vpn_delegate_(new VPNDelegateMus) {
- // Don't make an initial connection to exe:chrome. Do it on demand.
- DCHECK(!g_instance);
- g_instance = this;
-}
+SystemTrayDelegateMus::SystemTrayDelegateMus()
+ : networking_config_delegate_(new StubNetworkingConfigDelegate),
+ vpn_delegate_(new VPNDelegateMus) {}
SystemTrayDelegateMus::~SystemTrayDelegateMus() {
- DCHECK_EQ(this, g_instance);
- g_instance = nullptr;
-}
-
-// static
-SystemTrayDelegateMus* SystemTrayDelegateMus::Get() {
- return g_instance;
-}
-
-mojom::SystemTrayClient* SystemTrayDelegateMus::ConnectToSystemTrayClient() {
- if (!system_tray_client_.is_bound()) {
- // Connect (or reconnect) to the interface.
- connector_->ConnectToInterface("exe:chrome", &system_tray_client_);
-
- // Tolerate chrome crashing and coming back up.
- system_tray_client_.set_connection_error_handler(
- base::Bind(&SystemTrayDelegateMus::OnClientConnectionError,
- base::Unretained(this)));
- }
- return system_tray_client_.get();
-}
-
-void SystemTrayDelegateMus::OnClientConnectionError() {
- system_tray_client_.reset();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// SystemTrayDelegate:
-
-base::HourClockType SystemTrayDelegateMus::GetHourClockType() const {
- return hour_clock_type_;
-}
-
-void SystemTrayDelegateMus::ShowSettings() {
- ConnectToSystemTrayClient()->ShowSettings();
-}
-
-void SystemTrayDelegateMus::ShowDateSettings() {
- ConnectToSystemTrayClient()->ShowDateSettings();
-}
-
-void SystemTrayDelegateMus::ShowNetworkSettingsForGuid(
- const std::string& guid) {
- // http://crbug.com/647412
- NOTIMPLEMENTED();
-}
-
-void SystemTrayDelegateMus::ShowDisplaySettings() {
- ConnectToSystemTrayClient()->ShowDisplaySettings();
-}
-
-void SystemTrayDelegateMus::ShowPowerSettings() {
- ConnectToSystemTrayClient()->ShowPowerSettings();
-}
-
-void SystemTrayDelegateMus::ShowChromeSlow() {
- ConnectToSystemTrayClient()->ShowChromeSlow();
-}
-
-void SystemTrayDelegateMus::ShowIMESettings() {
- ConnectToSystemTrayClient()->ShowIMESettings();
-}
-
-void SystemTrayDelegateMus::ShowHelp() {
- ConnectToSystemTrayClient()->ShowHelp();
-}
-
-void SystemTrayDelegateMus::ShowAccessibilityHelp() {
- ConnectToSystemTrayClient()->ShowAccessibilityHelp();
-}
-
-void SystemTrayDelegateMus::ShowAccessibilitySettings() {
- ConnectToSystemTrayClient()->ShowAccessibilitySettings();
-}
-
-void SystemTrayDelegateMus::ShowPaletteHelp() {
- ConnectToSystemTrayClient()->ShowPaletteHelp();
-}
-
-void SystemTrayDelegateMus::ShowPaletteSettings() {
- ConnectToSystemTrayClient()->ShowPaletteSettings();
-}
-
-void SystemTrayDelegateMus::ShowPublicAccountInfo() {
- ConnectToSystemTrayClient()->ShowPublicAccountInfo();
-}
-
-void SystemTrayDelegateMus::ShowEnterpriseInfo() {
- // http://crbug.com/647412
- NOTIMPLEMENTED();
-}
-
-void SystemTrayDelegateMus::ShowProxySettings() {
- ConnectToSystemTrayClient()->ShowProxySettings();
}
NetworkingConfigDelegate* SystemTrayDelegateMus::GetNetworkingConfigDelegate()
@@ -154,12 +45,4 @@ VPNDelegate* SystemTrayDelegateMus::GetVPNDelegate() const {
return vpn_delegate_.get();
}
-////////////////////////////////////////////////////////////////////////////////
-// mojom::SystemTray:
-
-void SystemTrayDelegateMus::SetUse24HourClock(bool use_24_hour) {
- hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock;
- WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged();
-}
-
} // namespace ash
« no previous file with comments | « ash/mus/system_tray_delegate_mus.h ('k') | ash/mus/window_manager_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698