| 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/system/system_clock.h" | 17 #include "chrome/browser/chromeos/system/system_clock.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/ui/ash/ash_util.h" | 19 #include "chrome/browser/ui/ash/ash_util.h" |
| 19 #include "chrome/browser/ui/chrome_pages.h" | 20 #include "chrome/browser/ui/chrome_pages.h" |
| 20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 21 #include "chrome/browser/ui/singleton_tabs.h" | 22 #include "chrome/browser/ui/singleton_tabs.h" |
| 22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 23 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
| 24 #include "chromeos/login/login_state.h" | 25 #include "chromeos/login/login_state.h" |
| 25 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 content::RecordAction(base::UserMetricsAction("ShowPaletteOptions")); | 134 content::RecordAction(base::UserMetricsAction("ShowPaletteOptions")); |
| 134 ShowSettingsSubPageForActiveUser(kPaletteSettingsSubPageName); | 135 ShowSettingsSubPageForActiveUser(kPaletteSettingsSubPageName); |
| 135 } | 136 } |
| 136 | 137 |
| 137 void SystemTrayClient::ShowPublicAccountInfo() { | 138 void SystemTrayClient::ShowPublicAccountInfo() { |
| 138 chrome::ScopedTabbedBrowserDisplayer displayer( | 139 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 139 ProfileManager::GetActiveUserProfile()); | 140 ProfileManager::GetActiveUserProfile()); |
| 140 chrome::ShowPolicy(displayer.browser()); | 141 chrome::ShowPolicy(displayer.browser()); |
| 141 } | 142 } |
| 142 | 143 |
| 144 void SystemTrayClient::ShowNetworkConfigure(const std::string& service_path) { |
| 145 // TODO(jamescook): Consolidate this with the classic ash version from |
| 146 // NetworkConnectDelegateChromeOS. This will require moving the window |
| 147 // container calculation to this class, then plumbing a container ID through |
| 148 // the dialog code. |
| 149 CHECK(chrome::IsRunningInMash()); |
| 150 chromeos::NetworkConfigView::Show(service_path, nullptr /* parent */); |
| 151 } |
| 152 |
| 143 void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) { | 153 void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) { |
| 144 if (!chrome::IsRunningInMash()) { | 154 if (!chrome::IsRunningInMash()) { |
| 145 // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964 | 155 // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964 |
| 146 if (!LoginState::Get()->IsUserLoggedIn() || | 156 if (!LoginState::Get()->IsUserLoggedIn() || |
| 147 ash::WmShell::Get() | 157 ash::WmShell::Get() |
| 148 ->GetSessionStateDelegate() | 158 ->GetSessionStateDelegate() |
| 149 ->IsInSecondaryLoginScreen()) | 159 ->IsInSecondaryLoginScreen()) |
| 150 return; | 160 return; |
| 151 } | 161 } |
| 152 | 162 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 connector->ConnectToInterface("service:content_browser", &system_tray_); | 198 connector->ConnectToInterface("service:content_browser", &system_tray_); |
| 189 | 199 |
| 190 // Tolerate ash crashing and coming back up. | 200 // Tolerate ash crashing and coming back up. |
| 191 system_tray_.set_connection_error_handler(base::Bind( | 201 system_tray_.set_connection_error_handler(base::Bind( |
| 192 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); | 202 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
| 193 } | 203 } |
| 194 | 204 |
| 195 void SystemTrayClient::OnClientConnectionError() { | 205 void SystemTrayClient::OnClientConnectionError() { |
| 196 system_tray_.reset(); | 206 system_tray_.reset(); |
| 197 } | 207 } |
| OLD | NEW |