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/ui/app_list/apps_model_builder.h" | 5 #include "chrome/browser/ui/app_list/apps_model_builder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "chrome/browser/extensions/extension_prefs.h" | 10 #include "chrome/browser/extensions/extension_prefs.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 const gfx::ImageSkia& installing_icon) { | 81 const gfx::ImageSkia& installing_icon) { |
82 InsertApp(new ExtensionAppItem(profile_, | 82 InsertApp(new ExtensionAppItem(profile_, |
83 extension_id, | 83 extension_id, |
84 controller_, | 84 controller_, |
85 extension_name, | 85 extension_name, |
86 installing_icon)); | 86 installing_icon)); |
87 highlight_app_id_ = extension_id; | 87 highlight_app_id_ = extension_id; |
88 HighlightApp(); | 88 HighlightApp(); |
89 } | 89 } |
90 | 90 |
| 91 void AppsModelBuilder::OnDownloadProgress(const std::string& extension_id, |
| 92 int percent_downloaded) { |
| 93 int i = FindApp(extension_id); |
| 94 if (i == -1) |
| 95 return; |
| 96 GetAppAt(i)->SetPercentDownloaded(percent_downloaded); |
| 97 } |
| 98 |
91 void AppsModelBuilder::AddApps(const ExtensionSet* extensions, Apps* apps) { | 99 void AppsModelBuilder::AddApps(const ExtensionSet* extensions, Apps* apps) { |
92 for (ExtensionSet::const_iterator app = extensions->begin(); | 100 for (ExtensionSet::const_iterator app = extensions->begin(); |
93 app != extensions->end(); ++app) { | 101 app != extensions->end(); ++app) { |
94 if ((*app)->ShouldDisplayInAppLauncher()) | 102 if ((*app)->ShouldDisplayInAppLauncher()) |
95 apps->push_back(new ExtensionAppItem(profile_, | 103 apps->push_back(new ExtensionAppItem(profile_, |
96 (*app)->id(), | 104 (*app)->id(), |
97 controller_, | 105 controller_, |
98 "", | 106 "", |
99 gfx::ImageSkia())); | 107 gfx::ImageSkia())); |
100 } | 108 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 267 |
260 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL; | 268 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL; |
261 ExtensionAppItem* next = target_index + 1 < model_->item_count() ? | 269 ExtensionAppItem* next = target_index + 1 < model_->item_count() ? |
262 GetAppAt(target_index + 1) : NULL; | 270 GetAppAt(target_index + 1) : NULL; |
263 GetAppAt(target_index)->Move(prev, next); | 271 GetAppAt(target_index)->Move(prev, next); |
264 } | 272 } |
265 | 273 |
266 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) { | 274 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) { |
267 NOTREACHED(); | 275 NOTREACHED(); |
268 } | 276 } |
OLD | NEW |