| 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/memory/ptr_util.h" |   10 #include "base/memory/ptr_util.h" | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
|   39 #include "ui/base/l10n/l10n_util_collator.h" |   39 #include "ui/base/l10n/l10n_util_collator.h" | 
|   40 #include "ui/gfx/image/image.h" |   40 #include "ui/gfx/image/image.h" | 
|   41 #include "ui/gfx/image/image_skia.h" |   41 #include "ui/gfx/image/image_skia.h" | 
|   42  |   42  | 
|   43 using extensions::APIPermission; |   43 using extensions::APIPermission; | 
|   44 using extensions::Extension; |   44 using extensions::Extension; | 
|   45 using extensions::ExtensionList; |   45 using extensions::ExtensionList; | 
|   46 using extensions::ExtensionRegistry; |   46 using extensions::ExtensionRegistry; | 
|   47 using extensions::ExtensionSet; |   47 using extensions::ExtensionSet; | 
|   48 using extensions::PermissionSet; |   48 using extensions::PermissionSet; | 
|   49 using extensions::UnloadedExtensionInfo; |   49 using extensions::UnloadedExtensionReason; | 
|   50 using extensions::UpdatedExtensionPermissionsInfo; |   50 using extensions::UpdatedExtensionPermissionsInfo; | 
|   51  |   51  | 
|   52 class ExtensionNameComparator { |   52 class ExtensionNameComparator { | 
|   53  public: |   53  public: | 
|   54   bool operator()(const scoped_refptr<const Extension>& x, |   54   bool operator()(const scoped_refptr<const Extension>& x, | 
|   55                   const scoped_refptr<const Extension>& y) { |   55                   const scoped_refptr<const Extension>& y) { | 
|   56     return x->name() < y->name(); |   56     return x->name() < y->name(); | 
|   57   } |   57   } | 
|   58 }; |   58 }; | 
|   59  |   59  | 
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  319   // We only care about extensions that are background applications. |  319   // We only care about extensions that are background applications. | 
|  320   if (!IsBackgroundApp(*extension, profile_)) |  320   if (!IsBackgroundApp(*extension, profile_)) | 
|  321     return; |  321     return; | 
|  322   Update(); |  322   Update(); | 
|  323   AssociateApplicationData(extension); |  323   AssociateApplicationData(extension); | 
|  324 } |  324 } | 
|  325  |  325  | 
|  326 void BackgroundApplicationListModel::OnExtensionUnloaded( |  326 void BackgroundApplicationListModel::OnExtensionUnloaded( | 
|  327     content::BrowserContext* browser_context, |  327     content::BrowserContext* browser_context, | 
|  328     const Extension* extension, |  328     const Extension* extension, | 
|  329     UnloadedExtensionInfo::Reason reason) { |  329     UnloadedExtensionReason reason) { | 
|  330   if (!IsBackgroundApp(*extension, profile_)) |  330   if (!IsBackgroundApp(*extension, profile_)) | 
|  331     return; |  331     return; | 
|  332   Update(); |  332   Update(); | 
|  333   DissociateApplicationData(extension); |  333   DissociateApplicationData(extension); | 
|  334 } |  334 } | 
|  335  |  335  | 
|  336 void BackgroundApplicationListModel::OnExtensionSystemReady() { |  336 void BackgroundApplicationListModel::OnExtensionSystemReady() { | 
|  337   // All initial extensions will be loaded when extension system ready. So we |  337   // All initial extensions will be loaded when extension system ready. So we | 
|  338   // can get everything here. |  338   // can get everything here. | 
|  339   Update(); |  339   Update(); | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  399          (*old_cursor)->id() == (*new_cursor)->id()) { |  399          (*old_cursor)->id() == (*new_cursor)->id()) { | 
|  400     ++old_cursor; |  400     ++old_cursor; | 
|  401     ++new_cursor; |  401     ++new_cursor; | 
|  402   } |  402   } | 
|  403   if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |  403   if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 
|  404     extensions_ = extensions; |  404     extensions_ = extensions; | 
|  405     for (auto& observer : observers_) |  405     for (auto& observer : observers_) | 
|  406       observer.OnApplicationListChanged(profile_); |  406       observer.OnApplicationListChanged(profile_); | 
|  407   } |  407   } | 
|  408 } |  408 } | 
| OLD | NEW |