| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 virtual ~Application(); | 67 virtual ~Application(); |
| 68 | 68 |
| 69 // Invoked when a request icon is available. | 69 // Invoked when a request icon is available. |
| 70 virtual void OnImageLoaded(const gfx::Image& image, | 70 virtual void OnImageLoaded(const gfx::Image& image, |
| 71 const std::string& extension_id, | 71 const std::string& extension_id, |
| 72 int index) OVERRIDE; | 72 int index) OVERRIDE; |
| 73 | 73 |
| 74 // Uses the FILE thread to request this extension's icon, sized | 74 // Uses the FILE thread to request this extension's icon, sized |
| 75 // appropriately. | 75 // appropriately. |
| 76 void RequestIcon(ExtensionIconSet::Icons size); | 76 void RequestIcon(ExtensionIconSet::ExtensionIcons size); |
| 77 | 77 |
| 78 const Extension* extension_; | 78 const Extension* extension_; |
| 79 scoped_ptr<gfx::ImageSkia> icon_; | 79 scoped_ptr<gfx::ImageSkia> icon_; |
| 80 BackgroundApplicationListModel* model_; | 80 BackgroundApplicationListModel* model_; |
| 81 ImageLoadingTracker tracker_; | 81 ImageLoadingTracker tracker_; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 namespace { | 84 namespace { |
| 85 void GetServiceApplications(ExtensionService* service, | 85 void GetServiceApplications(ExtensionService* service, |
| 86 ExtensionList* applications_result) { | 86 ExtensionList* applications_result) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 const gfx::Image& image, | 148 const gfx::Image& image, |
| 149 const std::string& extension_id, | 149 const std::string& extension_id, |
| 150 int index) { | 150 int index) { |
| 151 if (image.IsEmpty()) | 151 if (image.IsEmpty()) |
| 152 return; | 152 return; |
| 153 icon_.reset(image.CopyImageSkia()); | 153 icon_.reset(image.CopyImageSkia()); |
| 154 model_->SendApplicationDataChangedNotifications(extension_); | 154 model_->SendApplicationDataChangedNotifications(extension_); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void BackgroundApplicationListModel::Application::RequestIcon( | 157 void BackgroundApplicationListModel::Application::RequestIcon( |
| 158 ExtensionIconSet::Icons size) { | 158 ExtensionIconSet::ExtensionIcons size) { |
| 159 ExtensionResource resource = extension_->GetIconResource( | 159 ExtensionResource resource = extension_->GetIconResource( |
| 160 size, ExtensionIconSet::MATCH_BIGGER); | 160 size, ExtensionIconSet::MATCH_BIGGER); |
| 161 tracker_.LoadImage(extension_, resource, gfx::Size(size, size), | 161 tracker_.LoadImage(extension_, resource, gfx::Size(size, size), |
| 162 ImageLoadingTracker::CACHE); | 162 ImageLoadingTracker::CACHE); |
| 163 } | 163 } |
| 164 | 164 |
| 165 BackgroundApplicationListModel::~BackgroundApplicationListModel() { | 165 BackgroundApplicationListModel::~BackgroundApplicationListModel() { |
| 166 STLDeleteContainerPairSecondPointers(applications_.begin(), | 166 STLDeleteContainerPairSecondPointers(applications_.begin(), |
| 167 applications_.end()); | 167 applications_.end()); |
| 168 } | 168 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 (*old_cursor)->name() == (*new_cursor)->name() && | 406 (*old_cursor)->name() == (*new_cursor)->name() && |
| 407 (*old_cursor)->id() == (*new_cursor)->id()) { | 407 (*old_cursor)->id() == (*new_cursor)->id()) { |
| 408 ++old_cursor; | 408 ++old_cursor; |
| 409 ++new_cursor; | 409 ++new_cursor; |
| 410 } | 410 } |
| 411 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 411 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
| 412 extensions_ = extensions; | 412 extensions_ = extensions; |
| 413 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 413 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
| 414 } | 414 } |
| 415 } | 415 } |
| OLD | NEW |