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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/extensions/extension_system.h" | 22 #include "chrome/browser/extensions/extension_system.h" |
23 #include "chrome/browser/extensions/image_loader.h" | 23 #include "chrome/browser/extensions/image_loader.h" |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/common/extensions/extension_constants.h" | 25 #include "chrome/common/extensions/extension_constants.h" |
26 #include "chrome/common/extensions/extension_icon_set.h" | 26 #include "chrome/common/extensions/extension_icon_set.h" |
27 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 27 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
28 #include "content/public/browser/notification_details.h" | 28 #include "content/public/browser/notification_details.h" |
29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
30 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
31 #include "extensions/common/extension_resource.h" | 31 #include "extensions/common/extension_resource.h" |
| 32 #include "extensions/common/extension_set.h" |
32 #include "extensions/common/manifest_handlers/background_info.h" | 33 #include "extensions/common/manifest_handlers/background_info.h" |
33 #include "extensions/common/permissions/permission_set.h" | 34 #include "extensions/common/permissions/permission_set.h" |
34 #include "ui/base/l10n/l10n_util_collator.h" | 35 #include "ui/base/l10n/l10n_util_collator.h" |
35 #include "ui/gfx/image/image.h" | 36 #include "ui/gfx/image/image.h" |
36 #include "ui/gfx/image/image_skia.h" | 37 #include "ui/gfx/image/image_skia.h" |
37 | 38 |
38 using extensions::APIPermission; | 39 using extensions::APIPermission; |
39 using extensions::Extension; | 40 using extensions::Extension; |
40 using extensions::ExtensionList; | 41 using extensions::ExtensionList; |
41 using extensions::PermissionSet; | 42 using extensions::PermissionSet; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void RequestIcon(extension_misc::ExtensionIcons size); | 82 void RequestIcon(extension_misc::ExtensionIcons size); |
82 | 83 |
83 const Extension* extension_; | 84 const Extension* extension_; |
84 scoped_ptr<gfx::ImageSkia> icon_; | 85 scoped_ptr<gfx::ImageSkia> icon_; |
85 BackgroundApplicationListModel* model_; | 86 BackgroundApplicationListModel* model_; |
86 }; | 87 }; |
87 | 88 |
88 namespace { | 89 namespace { |
89 void GetServiceApplications(ExtensionService* service, | 90 void GetServiceApplications(ExtensionService* service, |
90 ExtensionList* applications_result) { | 91 ExtensionList* applications_result) { |
91 const ExtensionSet* extensions = service->extensions(); | 92 const extensions::ExtensionSet* extensions = service->extensions(); |
92 | 93 |
93 for (ExtensionSet::const_iterator cursor = extensions->begin(); | 94 for (extensions::ExtensionSet::const_iterator cursor = extensions->begin(); |
94 cursor != extensions->end(); | 95 cursor != extensions->end(); |
95 ++cursor) { | 96 ++cursor) { |
96 const Extension* extension = cursor->get(); | 97 const Extension* extension = cursor->get(); |
97 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, | 98 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, |
98 service->profile())) { | 99 service->profile())) { |
99 applications_result->push_back(extension); | 100 applications_result->push_back(extension); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 // Walk the list of terminated extensions also (just because an extension | 104 // Walk the list of terminated extensions also (just because an extension |
104 // crashed doesn't mean we should ignore it). | 105 // crashed doesn't mean we should ignore it). |
105 extensions = service->terminated_extensions(); | 106 extensions = service->terminated_extensions(); |
106 for (ExtensionSet::const_iterator cursor = extensions->begin(); | 107 for (extensions::ExtensionSet::const_iterator cursor = extensions->begin(); |
107 cursor != extensions->end(); | 108 cursor != extensions->end(); |
108 ++cursor) { | 109 ++cursor) { |
109 const Extension* extension = cursor->get(); | 110 const Extension* extension = cursor->get(); |
110 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, | 111 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, |
111 service->profile())) { | 112 service->profile())) { |
112 applications_result->push_back(extension); | 113 applications_result->push_back(extension); |
113 } | 114 } |
114 } | 115 } |
115 | 116 |
116 std::string locale = g_browser_process->GetApplicationLocale(); | 117 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() && | 434 (*old_cursor)->name() == (*new_cursor)->name() && |
434 (*old_cursor)->id() == (*new_cursor)->id()) { | 435 (*old_cursor)->id() == (*new_cursor)->id()) { |
435 ++old_cursor; | 436 ++old_cursor; |
436 ++new_cursor; | 437 ++new_cursor; |
437 } | 438 } |
438 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 439 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
439 extensions_ = extensions; | 440 extensions_ = extensions; |
440 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 441 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
441 } | 442 } |
442 } | 443 } |
OLD | NEW |