| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/background/background_application_list_model.h" | 5 #include "chrome/browser/background/background_application_list_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const ExtensionSet* extensions = service->extensions(); | 74 const ExtensionSet* extensions = service->extensions(); |
| 75 | 75 |
| 76 for (ExtensionSet::const_iterator cursor = extensions->begin(); | 76 for (ExtensionSet::const_iterator cursor = extensions->begin(); |
| 77 cursor != extensions->end(); | 77 cursor != extensions->end(); |
| 78 ++cursor) { | 78 ++cursor) { |
| 79 const Extension* extension = *cursor; | 79 const Extension* extension = *cursor; |
| 80 if (BackgroundApplicationListModel::IsBackgroundApp(*extension)) | 80 if (BackgroundApplicationListModel::IsBackgroundApp(*extension)) |
| 81 applications_result->push_back(extension); | 81 applications_result->push_back(extension); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Walk the list of terminated extensions also (just because an extension | |
| 85 // crashed doesn't mean we should ignore it). | |
| 86 extensions = service->terminated_extensions(); | |
| 87 for (ExtensionSet::const_iterator cursor = extensions->begin(); | |
| 88 cursor != extensions->end(); | |
| 89 ++cursor) { | |
| 90 const Extension* extension = *cursor; | |
| 91 if (BackgroundApplicationListModel::IsBackgroundApp(*extension)) | |
| 92 applications_result->push_back(extension); | |
| 93 } | |
| 94 | |
| 95 std::string locale = g_browser_process->GetApplicationLocale(); | 84 std::string locale = g_browser_process->GetApplicationLocale(); |
| 96 icu::Locale loc(locale.c_str()); | 85 icu::Locale loc(locale.c_str()); |
| 97 UErrorCode error = U_ZERO_ERROR; | 86 UErrorCode error = U_ZERO_ERROR; |
| 98 scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(loc, error)); | 87 scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(loc, error)); |
| 99 sort(applications_result->begin(), applications_result->end(), | 88 sort(applications_result->begin(), applications_result->end(), |
| 100 ExtensionNameComparator(collator.get())); | 89 ExtensionNameComparator(collator.get())); |
| 101 } | 90 } |
| 102 | 91 |
| 103 } // namespace | 92 } // namespace |
| 104 | 93 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 (*old_cursor)->name() == (*new_cursor)->name() && | 338 (*old_cursor)->name() == (*new_cursor)->name() && |
| 350 (*old_cursor)->id() == (*new_cursor)->id()) { | 339 (*old_cursor)->id() == (*new_cursor)->id()) { |
| 351 ++old_cursor; | 340 ++old_cursor; |
| 352 ++new_cursor; | 341 ++new_cursor; |
| 353 } | 342 } |
| 354 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 343 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
| 355 extensions_ = extensions; | 344 extensions_ = extensions; |
| 356 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 345 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
| 357 } | 346 } |
| 358 } | 347 } |
| OLD | NEW |