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/extension_app_model_builder.h" | 5 #include "chrome/browser/ui/app_list/extension_app_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 "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 base::Unretained(this))); | 97 base::Unretained(this))); |
98 } | 98 } |
99 | 99 |
100 void ExtensionAppModelBuilder::OnProfilePreferenceChanged() { | 100 void ExtensionAppModelBuilder::OnProfilePreferenceChanged() { |
101 extensions::ExtensionSet extensions; | 101 extensions::ExtensionSet extensions; |
102 controller_->GetApps(profile_, &extensions); | 102 controller_->GetApps(profile_, &extensions); |
103 | 103 |
104 for (extensions::ExtensionSet::const_iterator app = extensions.begin(); | 104 for (extensions::ExtensionSet::const_iterator app = extensions.begin(); |
105 app != extensions.end(); ++app) { | 105 app != extensions.end(); ++app) { |
106 bool should_display = | 106 bool should_display = |
107 extensions::ui_util::ShouldDisplayInAppLauncher(*app, profile_); | 107 extensions::ui_util::ShouldDisplayInAppLauncher(app->get(), profile_); |
108 bool does_display = GetExtensionAppItem((*app)->id()) != NULL; | 108 bool does_display = GetExtensionAppItem((*app)->id()) != NULL; |
109 | 109 |
110 if (should_display == does_display) | 110 if (should_display == does_display) |
111 continue; | 111 continue; |
112 | 112 |
113 if (should_display) { | 113 if (should_display) { |
114 InsertApp(CreateAppItem((*app)->id(), | 114 InsertApp(CreateAppItem((*app)->id(), |
115 "", | 115 "", |
116 gfx::ImageSkia(), | 116 gfx::ImageSkia(), |
117 (*app)->is_platform_app())); | 117 (*app)->is_platform_app())); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 if (extension_registry_) | 278 if (extension_registry_) |
279 extension_registry_->AddObserver(this); | 279 extension_registry_->AddObserver(this); |
280 } | 280 } |
281 | 281 |
282 void ExtensionAppModelBuilder::PopulateApps() { | 282 void ExtensionAppModelBuilder::PopulateApps() { |
283 extensions::ExtensionSet extensions; | 283 extensions::ExtensionSet extensions; |
284 controller_->GetApps(profile_, &extensions); | 284 controller_->GetApps(profile_, &extensions); |
285 | 285 |
286 for (extensions::ExtensionSet::const_iterator app = extensions.begin(); | 286 for (extensions::ExtensionSet::const_iterator app = extensions.begin(); |
287 app != extensions.end(); ++app) { | 287 app != extensions.end(); ++app) { |
288 if (!extensions::ui_util::ShouldDisplayInAppLauncher(*app, profile_)) | 288 if (!extensions::ui_util::ShouldDisplayInAppLauncher(app->get(), profile_)) |
289 continue; | 289 continue; |
290 InsertApp(CreateAppItem((*app)->id(), | 290 InsertApp(CreateAppItem((*app)->id(), |
291 "", | 291 "", |
292 gfx::ImageSkia(), | 292 gfx::ImageSkia(), |
293 (*app)->is_platform_app())); | 293 (*app)->is_platform_app())); |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 void ExtensionAppModelBuilder::InsertApp(scoped_ptr<ExtensionAppItem> app) { | 297 void ExtensionAppModelBuilder::InsertApp(scoped_ptr<ExtensionAppItem> app) { |
298 if (service_) { | 298 if (service_) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 app_list::AppListItem* item = item_list->item_at(idx + 1); | 361 app_list::AppListItem* item = item_list->item_at(idx + 1); |
362 if (item->GetItemType() == ExtensionAppItem::kItemType) { | 362 if (item->GetItemType() == ExtensionAppItem::kItemType) { |
363 next = static_cast<ExtensionAppItem*>(item); | 363 next = static_cast<ExtensionAppItem*>(item); |
364 break; | 364 break; |
365 } | 365 } |
366 } | 366 } |
367 // item->Move will call set_position, overriding the item's position. | 367 // item->Move will call set_position, overriding the item's position. |
368 if (prev || next) | 368 if (prev || next) |
369 static_cast<ExtensionAppItem*>(item)->Move(prev, next); | 369 static_cast<ExtensionAppItem*>(item)->Move(prev, next); |
370 } | 370 } |
OLD | NEW |