Chromium Code Reviews| Index: chrome/browser/ui/ash/system_tray_client.cc |
| diff --git a/chrome/browser/ui/ash/system_tray_client.cc b/chrome/browser/ui/ash/system_tray_client.cc |
| index 68f796b041795a7b4c6d5f08437c74521a0c0491..143c33a47ca695cf78f49069754198b78887e796 100644 |
| --- a/chrome/browser/ui/ash/system_tray_client.cc |
| +++ b/chrome/browser/ui/ash/system_tray_client.cc |
| @@ -4,6 +4,8 @@ |
| #include "chrome/browser/ui/ash/system_tray_client.h" |
| +#include "ash/common/session/session_state_delegate.h" |
| +#include "ash/common/wm_shell.h" |
| #include "base/bind.h" |
| #include "base/bind_helpers.h" |
| #include "base/logging.h" |
| @@ -22,6 +24,7 @@ |
| #include "chromeos/login/login_state.h" |
| #include "content/public/browser/user_metrics.h" |
| #include "content/public/common/mojo_shell_connection.h" |
| +#include "net/base/escape.h" |
| #include "services/shell/public/cpp/connector.h" |
| #include "ui/base/l10n/l10n_util.h" |
| @@ -66,28 +69,6 @@ SystemTrayClient* SystemTrayClient::Get() { |
| return g_instance; |
| } |
| -void SystemTrayClient::ConnectToSystemTray() { |
| - if (system_tray_.is_bound()) |
| - return; |
| - |
| - shell::Connector* connector = |
| - content::MojoShellConnection::GetForProcess()->GetConnector(); |
| - // Under mash the SystemTray interface is in the ash process. In classic ash |
| - // we provide it to ourself. |
| - if (chrome::IsRunningInMash()) |
| - connector->ConnectToInterface("mojo:ash", &system_tray_); |
| - else |
| - connector->ConnectToInterface("exe:content_browser", &system_tray_); |
| - |
| - // Tolerate ash crashing and coming back up. |
| - system_tray_.set_connection_error_handler(base::Bind( |
| - &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
| -} |
| - |
| -void SystemTrayClient::OnClientConnectionError() { |
| - system_tray_.reset(); |
| -} |
| - |
| //////////////////////////////////////////////////////////////////////////////// |
| // ash::mojom::SystemTrayClient: |
| @@ -163,6 +144,24 @@ void SystemTrayClient::ShowPublicAccountInfo() { |
| chrome::ShowPolicy(displayer.browser()); |
| } |
| +void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) { |
| + if (!LoginState::Get()->IsUserLoggedIn()) |
| + return; |
| + |
| + // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964 |
|
msw
2016/10/05 22:56:36
bummer, but yeah...
|
| + if (!chrome::IsRunningInMash() && |
| + ash::WmShell::Get() |
| + ->GetSessionStateDelegate() |
| + ->IsInSecondaryLoginScreen()) |
| + return; |
| + |
| + std::string page = chrome::kInternetOptionsSubPage; |
| + if (!network_id.empty()) |
| + page += "?guid=" + net::EscapeUrlEncodedData(network_id, true); |
| + content::RecordAction(base::UserMetricsAction("OpenInternetOptionsDialog")); |
| + ShowSettingsSubPageForActiveUser(page); |
| +} |
| + |
| void SystemTrayClient::ShowProxySettings() { |
| LoginState* login_state = LoginState::Get(); |
| // User is not logged in. |
| @@ -179,3 +178,25 @@ void SystemTrayClient::OnSystemClockChanged( |
| ConnectToSystemTray(); |
| system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
| } |
| + |
| +void SystemTrayClient::ConnectToSystemTray() { |
| + if (system_tray_.is_bound()) |
| + return; |
| + |
| + shell::Connector* connector = |
| + content::MojoShellConnection::GetForProcess()->GetConnector(); |
| + // Under mash the SystemTray interface is in the ash process. In classic ash |
| + // we provide it to ourself. |
| + if (chrome::IsRunningInMash()) |
| + connector->ConnectToInterface("mojo:ash", &system_tray_); |
| + else |
| + connector->ConnectToInterface("exe:content_browser", &system_tray_); |
| + |
| + // Tolerate ash crashing and coming back up. |
| + system_tray_.set_connection_error_handler(base::Bind( |
| + &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
| +} |
| + |
| +void SystemTrayClient::OnClientConnectionError() { |
| + system_tray_.reset(); |
| +} |