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/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.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 "base/logging.h" | 11 #include "base/logging.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/browser_process_platform_part.h" | 13 #include "chrome/browser/browser_process_platform_part.h" |
14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
15 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 15 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
16 #include "chrome/browser/chromeos/options/network_config_view.h" | 16 #include "chrome/browser/chromeos/options/network_config_view.h" |
17 #include "chrome/browser/chromeos/system/system_clock.h" | 17 #include "chrome/browser/chromeos/system/system_clock.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/browser/ui/ash/ash_util.h" | 19 #include "chrome/browser/ui/ash/ash_util.h" |
20 #include "chrome/browser/ui/chrome_pages.h" | 20 #include "chrome/browser/ui/chrome_pages.h" |
21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
22 #include "chrome/browser/ui/singleton_tabs.h" | 22 #include "chrome/browser/ui/singleton_tabs.h" |
23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
24 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
25 #include "chromeos/login/login_state.h" | 25 #include "chromeos/login/login_state.h" |
| 26 #include "chromeos/network/network_handler.h" |
| 27 #include "chromeos/network/network_state.h" |
| 28 #include "chromeos/network/network_state_handler.h" |
26 #include "content/public/browser/user_metrics.h" | 29 #include "content/public/browser/user_metrics.h" |
27 #include "content/public/common/service_manager_connection.h" | 30 #include "content/public/common/service_manager_connection.h" |
28 #include "net/base/escape.h" | 31 #include "net/base/escape.h" |
29 #include "services/service_manager/public/cpp/connector.h" | 32 #include "services/service_manager/public/cpp/connector.h" |
30 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
31 | 34 |
32 using chromeos::LoginState; | 35 using chromeos::LoginState; |
33 | 36 |
34 namespace { | 37 namespace { |
35 | 38 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 content::RecordAction(base::UserMetricsAction("ShowPaletteOptions")); | 137 content::RecordAction(base::UserMetricsAction("ShowPaletteOptions")); |
135 ShowSettingsSubPageForActiveUser(kPaletteSettingsSubPageName); | 138 ShowSettingsSubPageForActiveUser(kPaletteSettingsSubPageName); |
136 } | 139 } |
137 | 140 |
138 void SystemTrayClient::ShowPublicAccountInfo() { | 141 void SystemTrayClient::ShowPublicAccountInfo() { |
139 chrome::ScopedTabbedBrowserDisplayer displayer( | 142 chrome::ScopedTabbedBrowserDisplayer displayer( |
140 ProfileManager::GetActiveUserProfile()); | 143 ProfileManager::GetActiveUserProfile()); |
141 chrome::ShowPolicy(displayer.browser()); | 144 chrome::ShowPolicy(displayer.browser()); |
142 } | 145 } |
143 | 146 |
144 void SystemTrayClient::ShowNetworkConfigure(const std::string& service_path) { | 147 void SystemTrayClient::ShowNetworkConfigure(const std::string& network_id) { |
145 // TODO(jamescook): Consolidate this with the classic ash version from | 148 // TODO(jamescook): Consolidate this with the classic ash version from |
146 // NetworkConnectDelegateChromeOS. This will require moving the window | 149 // NetworkConnectDelegateChromeOS. This will require moving the window |
147 // container calculation to this class, then plumbing a container ID through | 150 // container calculation to this class, then plumbing a container ID through |
148 // the dialog code. | 151 // the dialog code. |
149 CHECK(chrome::IsRunningInMash()); | 152 CHECK(chrome::IsRunningInMash()); |
150 chromeos::NetworkConfigView::Show(service_path, nullptr /* parent */); | 153 const chromeos::NetworkState* network = |
| 154 chromeos::NetworkHandler::Get() |
| 155 ->network_state_handler() |
| 156 ->GetNetworkStateFromGuid(network_id); |
| 157 if (!network) { |
| 158 LOG(ERROR) << "Network ID not found: " << network_id; |
| 159 return; |
| 160 } |
| 161 chromeos::NetworkConfigView::Show(network->path(), nullptr /* parent */); |
151 } | 162 } |
152 | 163 |
153 void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) { | 164 void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) { |
154 if (!chrome::IsRunningInMash()) { | 165 if (!chrome::IsRunningInMash()) { |
155 // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964 | 166 // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964 |
156 if (!LoginState::Get()->IsUserLoggedIn() || | 167 if (!LoginState::Get()->IsUserLoggedIn() || |
157 ash::WmShell::Get() | 168 ash::WmShell::Get() |
158 ->GetSessionStateDelegate() | 169 ->GetSessionStateDelegate() |
159 ->IsInSecondaryLoginScreen()) | 170 ->IsInSecondaryLoginScreen()) |
160 return; | 171 return; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 connector->ConnectToInterface("service:content_browser", &system_tray_); | 209 connector->ConnectToInterface("service:content_browser", &system_tray_); |
199 | 210 |
200 // Tolerate ash crashing and coming back up. | 211 // Tolerate ash crashing and coming back up. |
201 system_tray_.set_connection_error_handler(base::Bind( | 212 system_tray_.set_connection_error_handler(base::Bind( |
202 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); | 213 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
203 } | 214 } |
204 | 215 |
205 void SystemTrayClient::OnClientConnectionError() { | 216 void SystemTrayClient::OnClientConnectionError() { |
206 system_tray_.reset(); | 217 system_tray_.reset(); |
207 } | 218 } |
OLD | NEW |