| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 BackgroundApplicationListModel::~BackgroundApplicationListModel() { | 170 BackgroundApplicationListModel::~BackgroundApplicationListModel() { |
| 171 STLDeleteContainerPairSecondPointers(applications_.begin(), | 171 STLDeleteContainerPairSecondPointers(applications_.begin(), |
| 172 applications_.end()); | 172 applications_.end()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 BackgroundApplicationListModel::BackgroundApplicationListModel(Profile* profile) | 175 BackgroundApplicationListModel::BackgroundApplicationListModel(Profile* profile) |
| 176 : profile_(profile) { | 176 : profile_(profile) { |
| 177 DCHECK(profile_); | 177 DCHECK(profile_); |
| 178 registrar_.Add(this, | 178 registrar_.Add(this, |
| 179 chrome::NOTIFICATION_EXTENSION_LOADED, | 179 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 180 content::Source<Profile>(profile)); | 180 content::Source<Profile>(profile)); |
| 181 registrar_.Add(this, | 181 registrar_.Add(this, |
| 182 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 182 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 183 content::Source<Profile>(profile)); | 183 content::Source<Profile>(profile)); |
| 184 registrar_.Add(this, | 184 registrar_.Add(this, |
| 185 chrome::NOTIFICATION_EXTENSIONS_READY, | 185 chrome::NOTIFICATION_EXTENSIONS_READY, |
| 186 content::Source<Profile>(profile)); | 186 content::Source<Profile>(profile)); |
| 187 registrar_.Add(this, | 187 registrar_.Add(this, |
| 188 chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, | 188 chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, |
| 189 content::Source<Profile>(profile)); | 189 content::Source<Profile>(profile)); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { | 343 if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { |
| 344 Update(); | 344 Update(); |
| 345 return; | 345 return; |
| 346 } | 346 } |
| 347 ExtensionService* service = extensions::ExtensionSystem::Get(profile_)-> | 347 ExtensionService* service = extensions::ExtensionSystem::Get(profile_)-> |
| 348 extension_service(); | 348 extension_service(); |
| 349 if (!service || !service->is_ready()) | 349 if (!service || !service->is_ready()) |
| 350 return; | 350 return; |
| 351 | 351 |
| 352 switch (type) { | 352 switch (type) { |
| 353 case chrome::NOTIFICATION_EXTENSION_LOADED: | 353 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
| 354 OnExtensionLoaded(content::Details<Extension>(details).ptr()); | 354 OnExtensionLoaded(content::Details<Extension>(details).ptr()); |
| 355 break; | 355 break; |
| 356 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: | 356 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
| 357 OnExtensionUnloaded( | 357 OnExtensionUnloaded( |
| 358 content::Details<UnloadedExtensionInfo>(details)->extension); | 358 content::Details<UnloadedExtensionInfo>(details)->extension); |
| 359 break; | 359 break; |
| 360 case chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED: | 360 case chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED: |
| 361 OnExtensionPermissionsUpdated( | 361 OnExtensionPermissionsUpdated( |
| 362 content::Details<UpdatedExtensionPermissionsInfo>(details)->extension, | 362 content::Details<UpdatedExtensionPermissionsInfo>(details)->extension, |
| 363 content::Details<UpdatedExtensionPermissionsInfo>(details)->reason, | 363 content::Details<UpdatedExtensionPermissionsInfo>(details)->reason, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 (*old_cursor)->name() == (*new_cursor)->name() && | 438 (*old_cursor)->name() == (*new_cursor)->name() && |
| 439 (*old_cursor)->id() == (*new_cursor)->id()) { | 439 (*old_cursor)->id() == (*new_cursor)->id()) { |
| 440 ++old_cursor; | 440 ++old_cursor; |
| 441 ++new_cursor; | 441 ++new_cursor; |
| 442 } | 442 } |
| 443 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 443 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
| 444 extensions_ = extensions; | 444 extensions_ = extensions; |
| 445 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 445 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
| 446 } | 446 } |
| 447 } | 447 } |
| OLD | NEW |