OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/chromeos/app_mode/kiosk_mode_idle_app_name_notification
.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification
.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
12 #include "chrome/browser/chromeos/ui/idle_app_name_notification_view.h" | 11 #include "chrome/browser/chromeos/ui/idle_app_name_notification_view.h" |
13 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
16 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
| 16 #include "components/user_manager/user_manager.h" |
17 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
18 #include "ui/wm/core/user_activity_detector.h" | 18 #include "ui/wm/core/user_activity_detector.h" |
19 | 19 |
20 namespace chromeos { | 20 namespace chromeos { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // The timeout in ms before the message shows up. | 24 // The timeout in ms before the message shows up. |
25 const int kIdleAppNameNotificationTimeoutMs = 2 * 60 * 1000; | 25 const int kIdleAppNameNotificationTimeoutMs = 2 * 60 * 1000; |
26 | 26 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this)) { | 61 ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this)) { |
62 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); | 62 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); |
63 // At this time the DBusThreadManager might already be gone. | 63 // At this time the DBusThreadManager might already be gone. |
64 if (chromeos::DBusThreadManager::IsInitialized()) | 64 if (chromeos::DBusThreadManager::IsInitialized()) |
65 chromeos::DBusThreadManager::Get()->GetPowerManagerClient( | 65 chromeos::DBusThreadManager::Get()->GetPowerManagerClient( |
66 )->RemoveObserver(this); | 66 )->RemoveObserver(this); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 void KioskModeIdleAppNameNotification::Setup() { | 70 void KioskModeIdleAppNameNotification::Setup() { |
71 DCHECK(UserManager::Get()->IsUserLoggedIn()); | 71 DCHECK(user_manager::UserManager::Get()->IsUserLoggedIn()); |
72 Start(); | 72 Start(); |
73 } | 73 } |
74 | 74 |
75 void KioskModeIdleAppNameNotification::OnUserActivity(const ui::Event* event) { | 75 void KioskModeIdleAppNameNotification::OnUserActivity(const ui::Event* event) { |
76 if (show_notification_upon_next_user_activity_) { | 76 if (show_notification_upon_next_user_activity_) { |
77 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 77 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
78 const std::string app_id = | 78 const std::string app_id = |
79 command_line->GetSwitchValueASCII(::switches::kAppId); | 79 command_line->GetSwitchValueASCII(::switches::kAppId); |
80 Profile* profile = ProfileManager::GetActiveUserProfile(); | 80 Profile* profile = ProfileManager::GetActiveUserProfile(); |
81 notification_.reset( | 81 notification_.reset( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 base::Bind(&KioskModeIdleAppNameNotification::OnTimeout, | 118 base::Bind(&KioskModeIdleAppNameNotification::OnTimeout, |
119 base::Unretained(this))); | 119 base::Unretained(this))); |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 void KioskModeIdleAppNameNotification::OnTimeout() { | 123 void KioskModeIdleAppNameNotification::OnTimeout() { |
124 show_notification_upon_next_user_activity_ = true; | 124 show_notification_upon_next_user_activity_ = true; |
125 } | 125 } |
126 | 126 |
127 } // namespace chromeos | 127 } // namespace chromeos |
OLD | NEW |