| OLD | NEW |
| 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 "chrome/browser/ui/ash/system_tray_client.h" | 5 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 6 | 6 |
| 7 #include "ash/common/login_status.h" | 7 #include "ash/common/login_status.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 26 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
| 27 #include "chromeos/dbus/dbus_thread_manager.h" | 27 #include "chromeos/dbus/dbus_thread_manager.h" |
| 28 #include "chromeos/dbus/session_manager_client.h" | 28 #include "chromeos/dbus/session_manager_client.h" |
| 29 #include "chromeos/login/login_state.h" | 29 #include "chromeos/login/login_state.h" |
| 30 #include "content/public/browser/user_metrics.h" | 30 #include "content/public/browser/user_metrics.h" |
| 31 #include "content/public/common/service_manager_connection.h" | 31 #include "content/public/common/service_manager_connection.h" |
| 32 #include "net/base/escape.h" | 32 #include "net/base/escape.h" |
| 33 #include "services/service_manager/public/cpp/connector.h" | 33 #include "services/service_manager/public/cpp/connector.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/views/widget/widget_parent.h" |
| 35 | 36 |
| 36 using chromeos::DBusThreadManager; | 37 using chromeos::DBusThreadManager; |
| 37 using chromeos::LoginState; | 38 using chromeos::LoginState; |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 const char kDisplaySettingsSubPageName[] = "display"; | 42 const char kDisplaySettingsSubPageName[] = "display"; |
| 42 const char kPaletteSettingsSubPageName[] = "stylus-overlay"; | 43 const char kPaletteSettingsSubPageName[] = "stylus-overlay"; |
| 43 | 44 |
| 44 SystemTrayClient* g_instance = nullptr; | 45 SystemTrayClient* g_instance = nullptr; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 ShowSettingsSubPageForActiveUser(kPaletteSettingsSubPageName); | 192 ShowSettingsSubPageForActiveUser(kPaletteSettingsSubPageName); |
| 192 } | 193 } |
| 193 | 194 |
| 194 void SystemTrayClient::ShowPublicAccountInfo() { | 195 void SystemTrayClient::ShowPublicAccountInfo() { |
| 195 chrome::ScopedTabbedBrowserDisplayer displayer( | 196 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 196 ProfileManager::GetActiveUserProfile()); | 197 ProfileManager::GetActiveUserProfile()); |
| 197 chrome::ShowPolicy(displayer.browser()); | 198 chrome::ShowPolicy(displayer.browser()); |
| 198 } | 199 } |
| 199 | 200 |
| 200 void SystemTrayClient::ShowNetworkConfigure(const std::string& service_path) { | 201 void SystemTrayClient::ShowNetworkConfigure(const std::string& service_path) { |
| 201 // TODO(jamescook): Consolidate this with the classic ash version from | 202 // UI is not available at the lock screen. |
| 202 // NetworkConnectDelegateChromeOS. This will require moving the window | 203 // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964 |
| 203 // container calculation to this class, then plumbing a container ID through | 204 if (!chrome::IsRunningInMash() && |
| 204 // the dialog code. | 205 ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked()) |
| 205 CHECK(chrome::IsRunningInMash()); | 206 return; |
| 206 chromeos::NetworkConfigView::Show(service_path, nullptr /* parent */); | 207 |
| 208 views::WidgetParent parent; |
| 209 parent.container_id = GetDialogParentContainerId(); |
| 210 // Dialog will default to the primary display. |
| 211 chromeos::NetworkConfigView::Show(service_path, parent); |
| 207 } | 212 } |
| 208 | 213 |
| 209 void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) { | 214 void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) { |
| 210 if (!chrome::IsRunningInMash()) { | 215 if (!chrome::IsRunningInMash()) { |
| 211 // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964 | 216 // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964 |
| 212 if (!LoginState::Get()->IsUserLoggedIn() || | 217 if (!LoginState::Get()->IsUserLoggedIn() || |
| 213 ash::WmShell::Get() | 218 ash::WmShell::Get() |
| 214 ->GetSessionStateDelegate() | 219 ->GetSessionStateDelegate() |
| 215 ->IsInSecondaryLoginScreen()) | 220 ->IsInSecondaryLoginScreen()) |
| 216 return; | 221 return; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 connector->ConnectToInterface("service:content_browser", &system_tray_); | 259 connector->ConnectToInterface("service:content_browser", &system_tray_); |
| 255 | 260 |
| 256 // Tolerate ash crashing and coming back up. | 261 // Tolerate ash crashing and coming back up. |
| 257 system_tray_.set_connection_error_handler(base::Bind( | 262 system_tray_.set_connection_error_handler(base::Bind( |
| 258 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); | 263 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
| 259 } | 264 } |
| 260 | 265 |
| 261 void SystemTrayClient::OnClientConnectionError() { | 266 void SystemTrayClient::OnClientConnectionError() { |
| 262 system_tray_.reset(); | 267 system_tray_.reset(); |
| 263 } | 268 } |
| OLD | NEW |