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

Unified Diff: chrome/browser/chromeos/app_mode/kiosk_app_manager.cc

Issue 23494053: Remove NOTIFICATION_SYSTEM_SETTING_CHANGED, switch CrosSettings to base::CallbackRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trailing space Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc b/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
index c9e4ef8c9a2a698cc2b99f2b39b0143d0d658bb6..232b8b849975c1089a4626d6dd87accf07dc39a7 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
@@ -15,7 +15,6 @@
#include "base/prefs/pref_service.h"
#include "base/stl_util.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_data.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h"
#include "chrome/browser/chromeos/login/user_manager.h"
@@ -100,7 +99,7 @@ std::string KioskAppManager::GetAutoLaunchApp() const {
void KioskAppManager::SetAutoLaunchApp(const std::string& app_id) {
SetAutoLoginState(AUTOLOGIN_REQUESTED);
- // Clean first, so the proper change notifications are triggered even
+ // Clean first, so the proper change callbacks are triggered even
// if we are only changing AutoLoginState here.
if (!auto_launch_app_id_.empty()) {
CrosSettings::Get()->SetString(kAccountsPrefDeviceLocalAccountAutoLoginId,
@@ -314,19 +313,21 @@ void KioskAppManager::RemoveObserver(KioskAppManagerObserver* observer) {
KioskAppManager::KioskAppManager() : ownership_established_(false) {
UpdateAppData();
- CrosSettings::Get()->AddSettingsObserver(
- kAccountsPrefDeviceLocalAccounts, this);
- CrosSettings::Get()->AddSettingsObserver(
- kAccountsPrefDeviceLocalAccountAutoLoginId, this);
+ local_accounts_subscription_ =
+ CrosSettings::Get()->AddSettingsObserver(
+ kAccountsPrefDeviceLocalAccounts,
+ base::Bind(&KioskAppManager::UpdateAppData, base::Unretained(this)));
+ local_account_auto_login_id_subscription_ =
+ CrosSettings::Get()->AddSettingsObserver(
+ kAccountsPrefDeviceLocalAccountAutoLoginId,
+ base::Bind(&KioskAppManager::UpdateAppData, base::Unretained(this)));
}
KioskAppManager::~KioskAppManager() {}
void KioskAppManager::CleanUp() {
- CrosSettings::Get()->RemoveSettingsObserver(
- kAccountsPrefDeviceLocalAccounts, this);
- CrosSettings::Get()->RemoveSettingsObserver(
- kAccountsPrefDeviceLocalAccountAutoLoginId, this);
+ local_accounts_subscription_.reset();
+ local_account_auto_login_id_subscription_.reset();
apps_.clear();
}
@@ -394,13 +395,6 @@ void KioskAppManager::UpdateAppData() {
OnKioskAppsSettingsChanged());
}
-void KioskAppManager::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED, type);
- UpdateAppData();
-}
-
void KioskAppManager::GetKioskAppIconCacheDir(base::FilePath* cache_dir) {
base::FilePath user_data_dir;
CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));

Powered by Google App Engine
This is Rietveld 408576698