Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1003)

Side by Side Diff: chrome/browser/background/background_application_list_model.cc

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/app/chrome_command_ids.h" 12 #include "chrome/app/chrome_command_ids.h"
13 #include "chrome/browser/background/background_contents_service.h" 13 #include "chrome/browser/background/background_contents_service.h"
14 #include "chrome/browser/background/background_contents_service_factory.h" 14 #include "chrome/browser/background/background_contents_service_factory.h"
15 #include "chrome/browser/background/background_mode_manager.h" 15 #include "chrome/browser/background/background_mode_manager.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/extensions/extension_prefs.h" 17 #include "chrome/browser/extensions/extension_prefs.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/extension_system.h" 19 #include "chrome/browser/extensions/extension_system.h"
20 #include "chrome/browser/extensions/image_loader.h" 20 #include "chrome/browser/extensions/image_loader.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/common/chrome_notification_types.h" 22 #include "chrome/common/chrome_notification_types.h"
23 #include "chrome/common/extensions/api/icons/icons_handler.h"
23 #include "chrome/common/extensions/extension.h" 24 #include "chrome/common/extensions/extension.h"
24 #include "chrome/common/extensions/extension_constants.h" 25 #include "chrome/common/extensions/extension_constants.h"
25 #include "chrome/common/extensions/extension_icon_set.h" 26 #include "chrome/common/extensions/extension_icon_set.h"
26 #include "chrome/common/extensions/extension_resource.h" 27 #include "chrome/common/extensions/extension_resource.h"
27 #include "chrome/common/extensions/permissions/permission_set.h" 28 #include "chrome/common/extensions/permissions/permission_set.h"
28 #include "content/public/browser/notification_details.h" 29 #include "content/public/browser/notification_details.h"
29 #include "content/public/browser/notification_source.h" 30 #include "content/public/browser/notification_source.h"
30 #include "ui/base/l10n/l10n_util_collator.h" 31 #include "ui/base/l10n/l10n_util_collator.h"
31 #include "ui/gfx/image/image.h" 32 #include "ui/gfx/image/image.h"
32 #include "ui/gfx/image/image_skia.h" 33 #include "ui/gfx/image/image_skia.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void BackgroundApplicationListModel::Application::OnImageLoaded( 146 void BackgroundApplicationListModel::Application::OnImageLoaded(
146 const gfx::Image& image) { 147 const gfx::Image& image) {
147 if (image.IsEmpty()) 148 if (image.IsEmpty())
148 return; 149 return;
149 icon_.reset(image.CopyImageSkia()); 150 icon_.reset(image.CopyImageSkia());
150 model_->SendApplicationDataChangedNotifications(extension_); 151 model_->SendApplicationDataChangedNotifications(extension_);
151 } 152 }
152 153
153 void BackgroundApplicationListModel::Application::RequestIcon( 154 void BackgroundApplicationListModel::Application::RequestIcon(
154 extension_misc::ExtensionIcons size) { 155 extension_misc::ExtensionIcons size) {
155 ExtensionResource resource = extension_->GetIconResource( 156 ExtensionResource resource = extensions::IconsInfo::GetIconResource(
156 size, ExtensionIconSet::MATCH_BIGGER); 157 extension_, size, ExtensionIconSet::MATCH_BIGGER);
157 extensions::ImageLoader::Get(model_->profile_)->LoadImageAsync( 158 extensions::ImageLoader::Get(model_->profile_)->LoadImageAsync(
158 extension_, resource, gfx::Size(size, size), 159 extension_, resource, gfx::Size(size, size),
159 base::Bind(&Application::OnImageLoaded, AsWeakPtr())); 160 base::Bind(&Application::OnImageLoaded, AsWeakPtr()));
160 } 161 }
161 162
162 BackgroundApplicationListModel::~BackgroundApplicationListModel() { 163 BackgroundApplicationListModel::~BackgroundApplicationListModel() {
163 STLDeleteContainerPairSecondPointers(applications_.begin(), 164 STLDeleteContainerPairSecondPointers(applications_.begin(),
164 applications_.end()); 165 applications_.end());
165 } 166 }
166 167
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 (*old_cursor)->name() == (*new_cursor)->name() && 409 (*old_cursor)->name() == (*new_cursor)->name() &&
409 (*old_cursor)->id() == (*new_cursor)->id()) { 410 (*old_cursor)->id() == (*new_cursor)->id()) {
410 ++old_cursor; 411 ++old_cursor;
411 ++new_cursor; 412 ++new_cursor;
412 } 413 }
413 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { 414 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) {
414 extensions_ = extensions; 415 extensions_ = extensions;
415 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); 416 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_));
416 } 417 }
417 } 418 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698