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

Side by Side Diff: chrome/browser/ui/ash/system_tray_client.cc

Issue 2513673004: Reland: chromeos: Convert ash VPNDelegate interface to mojo (Closed)
Patch Set: fix manifest for reland Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/browser_process_platform_part.h" 16 #include "chrome/browser/browser_process_platform_part.h"
17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
18 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 18 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
19 #include "chrome/browser/chromeos/options/network_config_view.h" 19 #include "chrome/browser/chromeos/options/network_config_view.h"
20 #include "chrome/browser/chromeos/profiles/profile_helper.h"
20 #include "chrome/browser/chromeos/set_time_dialog.h" 21 #include "chrome/browser/chromeos/set_time_dialog.h"
21 #include "chrome/browser/chromeos/system/system_clock.h" 22 #include "chrome/browser/chromeos/system/system_clock.h"
22 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" 23 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h"
23 #include "chrome/browser/lifetime/application_lifetime.h" 24 #include "chrome/browser/lifetime/application_lifetime.h"
24 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
25 #include "chrome/browser/ui/ash/ash_util.h" 26 #include "chrome/browser/ui/ash/ash_util.h"
26 #include "chrome/browser/ui/chrome_pages.h" 27 #include "chrome/browser/ui/chrome_pages.h"
27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 28 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
28 #include "chrome/browser/ui/singleton_tabs.h" 29 #include "chrome/browser/ui/singleton_tabs.h"
29 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
30 #include "chromeos/dbus/dbus_thread_manager.h" 31 #include "chromeos/dbus/dbus_thread_manager.h"
31 #include "chromeos/dbus/session_manager_client.h" 32 #include "chromeos/dbus/session_manager_client.h"
32 #include "chromeos/login/login_state.h" 33 #include "chromeos/login/login_state.h"
34 #include "components/user_manager/user_manager.h"
33 #include "content/public/browser/user_metrics.h" 35 #include "content/public/browser/user_metrics.h"
34 #include "content/public/common/service_manager_connection.h" 36 #include "content/public/common/service_manager_connection.h"
35 #include "content/public/common/service_names.mojom.h" 37 #include "content/public/common/service_names.mojom.h"
38 #include "extensions/browser/api/vpn_provider/vpn_service.h"
39 #include "extensions/browser/api/vpn_provider/vpn_service_factory.h"
36 #include "net/base/escape.h" 40 #include "net/base/escape.h"
37 #include "services/service_manager/public/cpp/connector.h" 41 #include "services/service_manager/public/cpp/connector.h"
38 #include "services/ui/public/cpp/property_type_converters.h" 42 #include "services/ui/public/cpp/property_type_converters.h"
39 #include "services/ui/public/interfaces/window_manager.mojom.h" 43 #include "services/ui/public/interfaces/window_manager.mojom.h"
40 #include "third_party/cros_system_api/dbus/shill/dbus-constants.h" 44 #include "third_party/cros_system_api/dbus/shill/dbus-constants.h"
41 #include "ui/views/widget/widget.h" 45 #include "ui/views/widget/widget.h"
42 #include "ui/views/window/dialog_delegate.h" 46 #include "ui/views/window/dialog_delegate.h"
43 47
44 using chromeos::DBusThreadManager; 48 using chromeos::DBusThreadManager;
45 using chromeos::LoginState; 49 using chromeos::LoginState;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 251
248 void SystemTrayClient::ShowNetworkCreate(const std::string& type) { 252 void SystemTrayClient::ShowNetworkCreate(const std::string& type) {
249 int container_id = GetDialogParentContainerId(); 253 int container_id = GetDialogParentContainerId();
250 if (type == shill::kTypeCellular) { 254 if (type == shill::kTypeCellular) {
251 chromeos::ChooseMobileNetworkDialog::ShowDialogInContainer(container_id); 255 chromeos::ChooseMobileNetworkDialog::ShowDialogInContainer(container_id);
252 return; 256 return;
253 } 257 }
254 chromeos::NetworkConfigView::ShowForType(type, nullptr /* parent */); 258 chromeos::NetworkConfigView::ShowForType(type, nullptr /* parent */);
255 } 259 }
256 260
261 void SystemTrayClient::ShowThirdPartyVpnCreate(
262 const std::string& extension_id) {
263 const user_manager::User* primary_user =
264 user_manager::UserManager::Get()->GetPrimaryUser();
265 if (!primary_user)
266 return;
267
268 Profile* profile =
269 chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user);
270 if (!profile)
271 return;
272
273 // Request that the third-party VPN provider show its "add network" dialog.
274 chromeos::VpnServiceFactory::GetForBrowserContext(profile)
275 ->SendShowAddDialogToExtension(extension_id);
276 }
277
257 void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) { 278 void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) {
258 if (!chrome::IsRunningInMash()) { 279 if (!chrome::IsRunningInMash()) {
259 // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964 280 // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964
260 if (!LoginState::Get()->IsUserLoggedIn() || 281 if (!LoginState::Get()->IsUserLoggedIn() ||
261 ash::WmShell::Get() 282 ash::WmShell::Get()
262 ->GetSessionStateDelegate() 283 ->GetSessionStateDelegate()
263 ->IsInSecondaryLoginScreen()) 284 ->IsInSecondaryLoginScreen())
264 return; 285 return;
265 } 286 }
266 287
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 334 }
314 335
315 // Tolerate ash crashing and coming back up. 336 // Tolerate ash crashing and coming back up.
316 system_tray_.set_connection_error_handler(base::Bind( 337 system_tray_.set_connection_error_handler(base::Bind(
317 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); 338 &SystemTrayClient::OnClientConnectionError, base::Unretained(this)));
318 } 339 }
319 340
320 void SystemTrayClient::OnClientConnectionError() { 341 void SystemTrayClient::OnClientConnectionError() {
321 system_tray_.reset(); 342 system_tray_.reset();
322 } 343 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_client.h ('k') | chrome/browser/ui/ash/system_tray_delegate_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698