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

Side by Side Diff: chrome/browser/chromeos/screensaver/screensaver_controller.cc

Issue 12316077: Move the parsing of app.launch related keys out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/screensaver/screensaver_controller.h" 5 #include "chrome/browser/chromeos/screensaver/screensaver_controller.h"
6 6
7 #include "ash/screensaver/screensaver_view.h" 7 #include "ash/screensaver/screensaver_view.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/wm/user_activity_detector.h" 9 #include "ash/wm/user_activity_detector.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/extension_system.h" 14 #include "chrome/browser/extensions/extension_system.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/extensions/app_launcher_info.h"
17 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
18 #include "chromeos/dbus/dbus_thread_manager.h" 19 #include "chromeos/dbus/dbus_thread_manager.h"
19 #include "chromeos/dbus/power_manager_client.h" 20 #include "chromeos/dbus/power_manager_client.h"
20 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
21 22
22 namespace { 23 namespace {
23 24
24 const int kScreensaverTimeoutMinutes = 2; 25 const int kScreensaverTimeoutMinutes = 2;
25 26
26 ExtensionService* GetDefaultExtensionService() { 27 ExtensionService* GetDefaultExtensionService() {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 break; 127 break;
127 } 128 }
128 } 129 }
129 } 130 }
130 131
131 void ScreensaverController::IdleNotify(int64 threshold) { 132 void ScreensaverController::IdleNotify(int64 threshold) {
132 ExtensionService* service = GetDefaultExtensionService(); 133 ExtensionService* service = GetDefaultExtensionService();
133 const extensions::Extension* screensaver_extension = 134 const extensions::Extension* screensaver_extension =
134 service->GetExtensionById(screensaver_extension_id_, 135 service->GetExtensionById(screensaver_extension_id_,
135 ExtensionService::INCLUDE_ENABLED); 136 ExtensionService::INCLUDE_ENABLED);
136 ash::ShowScreensaver(screensaver_extension->GetFullLaunchURL()); 137 ash::ShowScreensaver(
138 extensions::AppLauncherInfo::GetFullLaunchURL(screensaver_extension));
137 139
138 if (!ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this)) 140 if (!ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this))
139 ash::Shell::GetInstance()->user_activity_detector()->AddObserver(this); 141 ash::Shell::GetInstance()->user_activity_detector()->AddObserver(this);
140 } 142 }
141 143
142 void ScreensaverController::OnUserActivity() { 144 void ScreensaverController::OnUserActivity() {
143 // We don't want to handle further user notifications; we'll either login 145 // We don't want to handle further user notifications; we'll either login
144 // the user and close out or or at least close the screensaver. 146 // the user and close out or or at least close the screensaver.
145 if (ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this)) 147 if (ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this))
146 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); 148 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this);
(...skipping 28 matching lines...) Expand all
175 ash::CloseScreensaver(); 177 ash::CloseScreensaver();
176 screensaver_extension_id_ = ""; 178 screensaver_extension_id_ = "";
177 } 179 }
178 180
179 void ScreensaverController::RequestNextIdleNotification() { 181 void ScreensaverController::RequestNextIdleNotification() {
180 DBusThreadManager::Get()->GetPowerManagerClient()-> 182 DBusThreadManager::Get()->GetPowerManagerClient()->
181 RequestIdleNotification(threshold_.InMilliseconds()); 183 RequestIdleNotification(threshold_.InMilliseconds());
182 } 184 }
183 185
184 } // namespace chromeos 186 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698