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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 | 90 |
91 void AppsModelBuilder::OnDownloadProgress(const std::string& extension_id, | 91 void AppsModelBuilder::OnDownloadProgress(const std::string& extension_id, |
92 int percent_downloaded) { | 92 int percent_downloaded) { |
93 int i = FindApp(extension_id); | 93 int i = FindApp(extension_id); |
94 if (i == -1) | 94 if (i == -1) |
95 return; | 95 return; |
96 GetAppAt(i)->SetPercentDownloaded(percent_downloaded); | 96 GetAppAt(i)->SetPercentDownloaded(percent_downloaded); |
97 } | 97 } |
98 | 98 |
| 99 void AppsModelBuilder::OnInstallFailure(const std::string& extension_id) { |
| 100 int i = FindApp(extension_id); |
| 101 if (i == -1) |
| 102 return; |
| 103 model_->DeleteAt(i); |
| 104 } |
| 105 |
99 void AppsModelBuilder::AddApps(const ExtensionSet* extensions, Apps* apps) { | 106 void AppsModelBuilder::AddApps(const ExtensionSet* extensions, Apps* apps) { |
100 for (ExtensionSet::const_iterator app = extensions->begin(); | 107 for (ExtensionSet::const_iterator app = extensions->begin(); |
101 app != extensions->end(); ++app) { | 108 app != extensions->end(); ++app) { |
102 if ((*app)->ShouldDisplayInAppLauncher()) | 109 if ((*app)->ShouldDisplayInAppLauncher()) |
103 apps->push_back(new ExtensionAppItem(profile_, | 110 apps->push_back(new ExtensionAppItem(profile_, |
104 (*app)->id(), | 111 (*app)->id(), |
105 controller_, | 112 controller_, |
106 "", | 113 "", |
107 gfx::ImageSkia())); | 114 gfx::ImageSkia())); |
108 } | 115 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 274 |
268 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL; | 275 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL; |
269 ExtensionAppItem* next = target_index + 1 < model_->item_count() ? | 276 ExtensionAppItem* next = target_index + 1 < model_->item_count() ? |
270 GetAppAt(target_index + 1) : NULL; | 277 GetAppAt(target_index + 1) : NULL; |
271 GetAppAt(target_index)->Move(prev, next); | 278 GetAppAt(target_index)->Move(prev, next); |
272 } | 279 } |
273 | 280 |
274 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) { | 281 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) { |
275 NOTREACHED(); | 282 NOTREACHED(); |
276 } | 283 } |
OLD | NEW |