| 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/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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 namespace { | 85 namespace { |
| 86 void GetServiceApplications(ExtensionService* service, | 86 void GetServiceApplications(ExtensionService* service, |
| 87 ExtensionList* applications_result) { | 87 ExtensionList* applications_result) { |
| 88 const ExtensionSet* extensions = service->extensions(); | 88 const ExtensionSet* extensions = service->extensions(); |
| 89 | 89 |
| 90 for (ExtensionSet::const_iterator cursor = extensions->begin(); | 90 for (ExtensionSet::const_iterator cursor = extensions->begin(); |
| 91 cursor != extensions->end(); | 91 cursor != extensions->end(); |
| 92 ++cursor) { | 92 ++cursor) { |
| 93 const Extension* extension = *cursor; | 93 const Extension* extension = cursor->get(); |
| 94 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, | 94 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, |
| 95 service->profile())) { | 95 service->profile())) { |
| 96 applications_result->push_back(extension); | 96 applications_result->push_back(extension); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Walk the list of terminated extensions also (just because an extension | 100 // Walk the list of terminated extensions also (just because an extension |
| 101 // crashed doesn't mean we should ignore it). | 101 // crashed doesn't mean we should ignore it). |
| 102 extensions = service->terminated_extensions(); | 102 extensions = service->terminated_extensions(); |
| 103 for (ExtensionSet::const_iterator cursor = extensions->begin(); | 103 for (ExtensionSet::const_iterator cursor = extensions->begin(); |
| 104 cursor != extensions->end(); | 104 cursor != extensions->end(); |
| 105 ++cursor) { | 105 ++cursor) { |
| 106 const Extension* extension = *cursor; | 106 const Extension* extension = cursor->get(); |
| 107 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, | 107 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, |
| 108 service->profile())) { | 108 service->profile())) { |
| 109 applications_result->push_back(extension); | 109 applications_result->push_back(extension); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 std::string locale = g_browser_process->GetApplicationLocale(); | 113 std::string locale = g_browser_process->GetApplicationLocale(); |
| 114 icu::Locale loc(locale.c_str()); | 114 icu::Locale loc(locale.c_str()); |
| 115 UErrorCode error = U_ZERO_ERROR; | 115 UErrorCode error = U_ZERO_ERROR; |
| 116 scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(loc, error)); | 116 scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(loc, error)); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 (*old_cursor)->name() == (*new_cursor)->name() && | 411 (*old_cursor)->name() == (*new_cursor)->name() && |
| 412 (*old_cursor)->id() == (*new_cursor)->id()) { | 412 (*old_cursor)->id() == (*new_cursor)->id()) { |
| 413 ++old_cursor; | 413 ++old_cursor; |
| 414 ++new_cursor; | 414 ++new_cursor; |
| 415 } | 415 } |
| 416 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 416 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
| 417 extensions_ = extensions; | 417 extensions_ = extensions; |
| 418 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 418 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
| 419 } | 419 } |
| 420 } | 420 } |
| OLD | NEW |