| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/notifications/message_center_settings_controller.h" | 5 #include "chrome/browser/notifications/message_center_settings_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/i18n/string_compare.h" | 12 #include "base/i18n/string_compare.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/threading/thread_restrictions.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
| 18 #include "chrome/browser/notifications/application_notifier_source.h" | 19 #include "chrome/browser/notifications/application_notifier_source.h" |
| 19 #include "chrome/browser/notifications/web_page_notifier_source.h" | 20 #include "chrome/browser/notifications/web_page_notifier_source.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/profiles/profile_attributes_entry.h" | 22 #include "chrome/browser/profiles/profile_attributes_entry.h" |
| 22 #include "chrome/browser/profiles/profile_attributes_storage.h" | 23 #include "chrome/browser/profiles/profile_attributes_storage.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 observer.NotifierEnabledChanged(id, enabled); | 329 observer.NotifierEnabledChanged(id, enabled); |
| 329 } | 330 } |
| 330 | 331 |
| 331 void MessageCenterSettingsController::DispatchNotifierGroupChanged() { | 332 void MessageCenterSettingsController::DispatchNotifierGroupChanged() { |
| 332 for (message_center::NotifierSettingsObserver& observer : observers_) | 333 for (message_center::NotifierSettingsObserver& observer : observers_) |
| 333 observer.NotifierGroupChanged(); | 334 observer.NotifierGroupChanged(); |
| 334 } | 335 } |
| 335 | 336 |
| 336 #if defined(OS_CHROMEOS) | 337 #if defined(OS_CHROMEOS) |
| 337 void MessageCenterSettingsController::CreateNotifierGroupForGuestLogin() { | 338 void MessageCenterSettingsController::CreateNotifierGroupForGuestLogin() { |
| 339 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 338 // Already created. | 340 // Already created. |
| 339 if (!notifier_groups_.empty()) | 341 if (!notifier_groups_.empty()) |
| 340 return; | 342 return; |
| 341 | 343 |
| 342 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 344 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 343 // |notifier_groups_| can be empty in login screen too. | 345 // |notifier_groups_| can be empty in login screen too. |
| 344 if (!user_manager->IsLoggedInAsGuest()) | 346 if (!user_manager->IsLoggedInAsGuest()) |
| 345 return; | 347 return; |
| 346 | 348 |
| 347 user_manager::User* user = user_manager->GetActiveUser(); | 349 user_manager::User* user = user_manager->GetActiveUser(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 FROM_HERE, | 411 FROM_HERE, |
| 410 base::Bind( | 412 base::Bind( |
| 411 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, | 413 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, |
| 412 weak_factory_.GetWeakPtr())); | 414 weak_factory_.GetWeakPtr())); |
| 413 } | 415 } |
| 414 #endif | 416 #endif |
| 415 | 417 |
| 416 if (notify) | 418 if (notify) |
| 417 DispatchNotifierGroupChanged(); | 419 DispatchNotifierGroupChanged(); |
| 418 } | 420 } |
| OLD | NEW |