| OLD | NEW |
| 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/notifications/desktop_notification_service.h" | 5 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 new WelcomeNotification(profile_, g_browser_process->message_center())); | 623 new WelcomeNotification(profile_, g_browser_process->message_center())); |
| 624 } | 624 } |
| 625 | 625 |
| 626 if (welcome_notification) | 626 if (welcome_notification) |
| 627 welcome_notification->ShowWelcomeNotificationIfNecessary(notification); | 627 welcome_notification->ShowWelcomeNotificationIfNecessary(notification); |
| 628 } | 628 } |
| 629 | 629 |
| 630 void DesktopNotificationService::OnStringListPrefChanged( | 630 void DesktopNotificationService::OnStringListPrefChanged( |
| 631 const char* pref_name, std::set<std::string>* ids_field) { | 631 const char* pref_name, std::set<std::string>* ids_field) { |
| 632 ids_field->clear(); | 632 ids_field->clear(); |
| 633 const base::ListValue* pref_list = profile_->GetPrefs()->GetList(pref_name); | 633 // Separate GetPrefs()->GetList() to analyze the crash. See crbug.com/322320 |
| 634 const PrefService* pref_service = profile_->GetPrefs(); |
| 635 CHECK(pref_service); |
| 636 const base::ListValue* pref_list = pref_service->GetList(pref_name); |
| 634 for (size_t i = 0; i < pref_list->GetSize(); ++i) { | 637 for (size_t i = 0; i < pref_list->GetSize(); ++i) { |
| 635 std::string element; | 638 std::string element; |
| 636 if (pref_list->GetString(i, &element) && !element.empty()) | 639 if (pref_list->GetString(i, &element) && !element.empty()) |
| 637 ids_field->insert(element); | 640 ids_field->insert(element); |
| 638 else | 641 else |
| 639 LOG(WARNING) << i << "-th element is not a string for " << pref_name; | 642 LOG(WARNING) << i << "-th element is not a string for " << pref_name; |
| 640 } | 643 } |
| 641 } | 644 } |
| 642 | 645 |
| 643 void DesktopNotificationService::Observe( | 646 void DesktopNotificationService::Observe( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 673 // Tell the IO thread that this extension's permission for notifications | 676 // Tell the IO thread that this extension's permission for notifications |
| 674 // has changed. | 677 // has changed. |
| 675 extensions::InfoMap* extension_info_map = | 678 extensions::InfoMap* extension_info_map = |
| 676 extensions::ExtensionSystem::Get(profile_)->info_map(); | 679 extensions::ExtensionSystem::Get(profile_)->info_map(); |
| 677 BrowserThread::PostTask( | 680 BrowserThread::PostTask( |
| 678 BrowserThread::IO, FROM_HERE, | 681 BrowserThread::IO, FROM_HERE, |
| 679 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, | 682 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, |
| 680 extension_info_map, notifier_id.id, !enabled)); | 683 extension_info_map, notifier_id.id, !enabled)); |
| 681 | 684 |
| 682 } | 685 } |
| OLD | NEW |