OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/privet_notifications.h" | 5 #include "chrome/browser/local_discovery/privet_notifications.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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 g_browser_process->notification_ui_manager()->CancelById( | 290 g_browser_process->notification_ui_manager()->CancelById( |
291 kPrivetNotificationID); | 291 kPrivetNotificationID); |
292 } | 292 } |
293 | 293 |
294 void PrivetNotificationService::Start() { | 294 void PrivetNotificationService::Start() { |
295 #if defined(CHROMEOS) | 295 #if defined(CHROMEOS) |
296 SigninManagerBase* signin_manager = | 296 SigninManagerBase* signin_manager = |
297 SigninManagerFactory::GetForProfileIfExists( | 297 SigninManagerFactory::GetForProfileIfExists( |
298 Profile::FromBrowserContext(profile_)); | 298 Profile::FromBrowserContext(profile_)); |
299 | 299 |
300 if (!signin_manager || signin_manager->GetAuthenticatedUsername().empty()) | 300 if (!signin_manager || !signin_manager->IsAuthenticated()) |
301 return; | 301 return; |
302 #endif | 302 #endif |
303 | 303 |
304 enable_privet_notification_member_.Init( | 304 enable_privet_notification_member_.Init( |
305 prefs::kLocalDiscoveryNotificationsEnabled, | 305 prefs::kLocalDiscoveryNotificationsEnabled, |
306 Profile::FromBrowserContext(profile_)->GetPrefs(), | 306 Profile::FromBrowserContext(profile_)->GetPrefs(), |
307 base::Bind(&PrivetNotificationService::OnNotificationsEnabledChanged, | 307 base::Bind(&PrivetNotificationService::OnNotificationsEnabledChanged, |
308 base::Unretained(this))); | 308 base::Unretained(this))); |
309 OnNotificationsEnabledChanged(); | 309 OnNotificationsEnabledChanged(); |
310 } | 310 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 407 |
408 void PrivetNotificationDelegate::DisableNotifications() { | 408 void PrivetNotificationDelegate::DisableNotifications() { |
409 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 409 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
410 | 410 |
411 profile_obj->GetPrefs()->SetBoolean( | 411 profile_obj->GetPrefs()->SetBoolean( |
412 prefs::kLocalDiscoveryNotificationsEnabled, | 412 prefs::kLocalDiscoveryNotificationsEnabled, |
413 false); | 413 false); |
414 } | 414 } |
415 | 415 |
416 } // namespace local_discovery | 416 } // namespace local_discovery |
OLD | NEW |