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

Unified Diff: chrome/browser/ui/ash/system_tray_client.cc

Issue 2396863004: chromeos: Refactor system tray ShowNetworkSettingsForGuid for mash (Closed)
Patch Set: rebase 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
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 d817fe1fa1d3d141bfd5b9738e1626179262b8db..2e3414e19ff3136e5b81eb0f06368543f7210cd1 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("service:ash", &system_tray_);
- else
- connector->ConnectToInterface("service: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,23 @@ void SystemTrayClient::ShowPublicAccountInfo() {
chrome::ShowPolicy(displayer.browser());
}
+void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) {
+ if (!chrome::IsRunningInMash()) {
+ // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964
+ if (!LoginState::Get()->IsUserLoggedIn() ||
+ 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 +177,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("service:ash", &system_tray_);
+ else
+ connector->ConnectToInterface("service: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();
+}

Powered by Google App Engine
This is Rietveld 408576698