| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/chromeos/ui/idle_app_name_notification_view.h" | 10 #include "chrome/browser/chromeos/ui/idle_app_name_notification_view.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chromeos/dbus/dbus_thread_manager.h" | 14 #include "chromeos/dbus/dbus_thread_manager.h" |
| 15 #include "components/user_manager/user_manager.h" | 15 #include "components/user_manager/user_manager.h" |
| 16 #include "extensions/browser/extension_system.h" | 16 #include "extensions/browser/extension_system.h" |
| 17 #include "ui/base/user_activity/user_activity_detector.h" | 17 #include "ui/base/user_activity/user_activity_detector.h" |
| 18 #include "ui/gfx/display.h" | 18 #include "ui/display/display.h" |
| 19 #include "ui/gfx/screen.h" | 19 #include "ui/display/screen.h" |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // The timeout in ms before the message shows up. | 25 // The timeout in ms before the message shows up. |
| 26 const int kIdleAppNameNotificationTimeoutMs = 20 * 60 * 1000; | 26 const int kIdleAppNameNotificationTimeoutMs = 20 * 60 * 1000; |
| 27 | 27 |
| 28 // The duration of visibility for the message. | 28 // The duration of visibility for the message. |
| 29 const int kMessageVisibilityTimeMs = 3000; | 29 const int kMessageVisibilityTimeMs = 3000; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 void KioskModeIdleAppNameNotification::Setup() { | 72 void KioskModeIdleAppNameNotification::Setup() { |
| 73 DCHECK(user_manager::UserManager::Get()->IsUserLoggedIn()); | 73 DCHECK(user_manager::UserManager::Get()->IsUserLoggedIn()); |
| 74 Start(); | 74 Start(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void KioskModeIdleAppNameNotification::OnUserActivity(const ui::Event* event) { | 77 void KioskModeIdleAppNameNotification::OnUserActivity(const ui::Event* event) { |
| 78 if (show_notification_upon_next_user_activity_) { | 78 if (show_notification_upon_next_user_activity_) { |
| 79 gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); | 79 display::Display display = |
| 80 display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 80 // Display the notification only on internal display. | 81 // Display the notification only on internal display. |
| 81 if (display.IsInternal()) { | 82 if (display.IsInternal()) { |
| 82 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 83 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 83 const std::string app_id = | 84 const std::string app_id = |
| 84 command_line->GetSwitchValueASCII(::switches::kAppId); | 85 command_line->GetSwitchValueASCII(::switches::kAppId); |
| 85 Profile* profile = ProfileManager::GetActiveUserProfile(); | 86 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 86 notification_.reset( | 87 notification_.reset( |
| 87 new IdleAppNameNotificationView( | 88 new IdleAppNameNotificationView( |
| 88 kMessageVisibilityTimeMs, | 89 kMessageVisibilityTimeMs, |
| 89 kMessageAnimationTimeMs, | 90 kMessageAnimationTimeMs, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 base::Bind(&KioskModeIdleAppNameNotification::OnTimeout, | 125 base::Bind(&KioskModeIdleAppNameNotification::OnTimeout, |
| 125 base::Unretained(this))); | 126 base::Unretained(this))); |
| 126 } | 127 } |
| 127 } | 128 } |
| 128 | 129 |
| 129 void KioskModeIdleAppNameNotification::OnTimeout() { | 130 void KioskModeIdleAppNameNotification::OnTimeout() { |
| 130 show_notification_upon_next_user_activity_ = true; | 131 show_notification_upon_next_user_activity_ = true; |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace chromeos | 134 } // namespace chromeos |
| OLD | NEW |