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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/string_compare.h" | 10 #include "base/i18n/string_compare.h" |
11 #include "base/message_loop/message_loop_proxy.h" | |
12 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
13 #include "base/task/cancelable_task_tracker.h" | 12 #include "base/task/cancelable_task_tracker.h" |
| 13 #include "base/thread_task_runner_handle.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/extensions/app_icon_loader_impl.h" | 16 #include "chrome/browser/extensions/app_icon_loader_impl.h" |
17 #include "chrome/browser/favicon/favicon_service_factory.h" | 17 #include "chrome/browser/favicon/favicon_service_factory.h" |
18 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | 18 #include "chrome/browser/notifications/desktop_notification_profile_util.h" |
19 #include "chrome/browser/notifications/desktop_notification_service.h" | 19 #include "chrome/browser/notifications/desktop_notification_service.h" |
20 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 20 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/profiles/profile_info_cache.h" | 22 #include "chrome/browser/profiles/profile_info_cache.h" |
23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 // get the group here. | 533 // get the group here. |
534 if (notifier_groups_.empty() && user_manager::UserManager::IsInitialized() && | 534 if (notifier_groups_.empty() && user_manager::UserManager::IsInitialized() && |
535 user_manager::UserManager::Get()->IsLoggedInAsGuest()) { | 535 user_manager::UserManager::Get()->IsLoggedInAsGuest()) { |
536 // Do not invoke CreateNotifierGroupForGuestLogin() directly. In some tests, | 536 // Do not invoke CreateNotifierGroupForGuestLogin() directly. In some tests, |
537 // this method may be called before the primary profile is created, which | 537 // this method may be called before the primary profile is created, which |
538 // means ProfileHelper::Get()->GetProfileByUser() will create a new primary | 538 // means ProfileHelper::Get()->GetProfileByUser() will create a new primary |
539 // profile. But creating a primary profile causes an Observe() before | 539 // profile. But creating a primary profile causes an Observe() before |
540 // registering it as the primary one, which causes this method which causes | 540 // registering it as the primary one, which causes this method which causes |
541 // another creating a primary profile, and causes an infinite loop. | 541 // another creating a primary profile, and causes an infinite loop. |
542 // Thus, it would be better to delay creating group for guest login. | 542 // Thus, it would be better to delay creating group for guest login. |
543 base::MessageLoopProxy::current()->PostTask( | 543 base::ThreadTaskRunnerHandle::Get()->PostTask( |
544 FROM_HERE, | 544 FROM_HERE, |
545 base::Bind( | 545 base::Bind( |
546 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, | 546 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, |
547 weak_factory_.GetWeakPtr())); | 547 weak_factory_.GetWeakPtr())); |
548 } | 548 } |
549 #endif | 549 #endif |
550 | 550 |
551 if (notify) { | 551 if (notify) { |
552 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, | 552 FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, |
553 observers_, | 553 observers_, |
554 NotifierGroupChanged()); | 554 NotifierGroupChanged()); |
555 } | 555 } |
556 } | 556 } |
OLD | NEW |