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

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

Issue 2434683003: Move NetworkStateNotifier and NetworkConnect from src/ui (Closed)
Patch Set: Fix virtuals 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/ash/network_connect_delegate_chromeos.h"
6
7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/wm_shell.h"
9 #include "ash/shell.h"
10 #include "chrome/browser/chromeos/enrollment_dialog_view.h"
11 #include "chrome/browser/chromeos/sim_dialog_delegate.h"
12 #include "chrome/browser/ui/ash/system_tray_client.h"
13 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h"
14
15 namespace {
16
17 bool IsUIAvailable() {
18 return ash::WmShell::HasInstance() &&
19 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked();
20 }
21
22 gfx::NativeWindow GetNativeWindow() {
23 int container_id = SystemTrayClient::GetDialogParentContainerId();
24 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
25 container_id);
26 }
27
28 } // namespace
29
30 namespace chromeos {
31
32 NetworkConnectDelegateChromeOS::NetworkConnectDelegateChromeOS() {}
33
34 NetworkConnectDelegateChromeOS::~NetworkConnectDelegateChromeOS() {}
35
36 void NetworkConnectDelegateChromeOS::ShowNetworkConfigure(
37 const std::string& network_id) {
38 if (!IsUIAvailable())
39 return;
40 SystemTrayClient::Get()->ShowNetworkConfigure(network_id);
41 }
42
43 void NetworkConnectDelegateChromeOS::ShowNetworkSettings(
44 const std::string& network_id) {
45 if (!IsUIAvailable())
46 return;
47 SystemTrayClient::Get()->ShowNetworkSettings(network_id);
48 }
49
50 bool NetworkConnectDelegateChromeOS::ShowEnrollNetwork(
51 const std::string& network_id) {
52 if (!IsUIAvailable())
53 return false;
54 return enrollment::CreateDialog(network_id, GetNativeWindow());
55 }
56
57 void NetworkConnectDelegateChromeOS::ShowMobileSimDialog() {
58 if (!IsUIAvailable())
59 return;
60 SimDialogDelegate::ShowDialog(GetNativeWindow(),
61 SimDialogDelegate::SIM_DIALOG_UNLOCK);
62 }
63
64 void NetworkConnectDelegateChromeOS::ShowMobileSetupDialog(
65 const std::string& network_id) {
66 if (!IsUIAvailable())
67 return;
68 MobileSetupDialog::ShowByNetworkId(network_id);
69 }
70
71 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/network_connect_delegate_chromeos.h ('k') | chrome/browser/ui/ash/vpn_delegate_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698