| 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/sha1.h" | 10 #include "base/sha1.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 void RequestIcon(extension_misc::ExtensionIcons size); | 81 void RequestIcon(extension_misc::ExtensionIcons size); |
| 82 | 82 |
| 83 const Extension* extension_; | 83 const Extension* extension_; |
| 84 scoped_ptr<gfx::ImageSkia> icon_; | 84 scoped_ptr<gfx::ImageSkia> icon_; |
| 85 BackgroundApplicationListModel* model_; | 85 BackgroundApplicationListModel* model_; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 namespace { | 88 namespace { |
| 89 void GetServiceApplications(ExtensionService* service, | 89 void GetServiceApplications(ExtensionService* service, |
| 90 ExtensionList* applications_result) { | 90 ExtensionList* applications_result) { |
| 91 const ExtensionSet* extensions = service->extensions(); | 91 const extensions::ExtensionSet* extensions = service->extensions(); |
| 92 | 92 |
| 93 for (ExtensionSet::const_iterator cursor = extensions->begin(); | 93 for (extensions::ExtensionSet::const_iterator cursor = extensions->begin(); |
| 94 cursor != extensions->end(); | 94 cursor != extensions->end(); |
| 95 ++cursor) { | 95 ++cursor) { |
| 96 const Extension* extension = cursor->get(); | 96 const Extension* extension = cursor->get(); |
| 97 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, | 97 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, |
| 98 service->profile())) { | 98 service->profile())) { |
| 99 applications_result->push_back(extension); | 99 applications_result->push_back(extension); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 // Walk the list of terminated extensions also (just because an extension | 103 // Walk the list of terminated extensions also (just because an extension |
| 104 // crashed doesn't mean we should ignore it). | 104 // crashed doesn't mean we should ignore it). |
| 105 extensions = service->terminated_extensions(); | 105 extensions = service->terminated_extensions(); |
| 106 for (ExtensionSet::const_iterator cursor = extensions->begin(); | 106 for (extensions::ExtensionSet::const_iterator cursor = extensions->begin(); |
| 107 cursor != extensions->end(); | 107 cursor != extensions->end(); |
| 108 ++cursor) { | 108 ++cursor) { |
| 109 const Extension* extension = cursor->get(); | 109 const Extension* extension = cursor->get(); |
| 110 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, | 110 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, |
| 111 service->profile())) { | 111 service->profile())) { |
| 112 applications_result->push_back(extension); | 112 applications_result->push_back(extension); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 std::string locale = g_browser_process->GetApplicationLocale(); | 116 std::string locale = g_browser_process->GetApplicationLocale(); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 (*old_cursor)->name() == (*new_cursor)->name() && | 433 (*old_cursor)->name() == (*new_cursor)->name() && |
| 434 (*old_cursor)->id() == (*new_cursor)->id()) { | 434 (*old_cursor)->id() == (*new_cursor)->id()) { |
| 435 ++old_cursor; | 435 ++old_cursor; |
| 436 ++new_cursor; | 436 ++new_cursor; |
| 437 } | 437 } |
| 438 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 438 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
| 439 extensions_ = extensions; | 439 extensions_ = extensions; |
| 440 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 440 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
| 441 } | 441 } |
| 442 } | 442 } |
| OLD | NEW |