| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/extensions/extension_ui_util.h" | 14 #include "chrome/browser/extensions/extension_ui_util.h" |
| 15 #include "chrome/browser/extensions/install_tracker.h" | 15 #include "chrome/browser/extensions/install_tracker.h" |
| 16 #include "chrome/browser/extensions/install_tracker_factory.h" | 16 #include "chrome/browser/extensions/install_tracker_factory.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 18 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 19 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 19 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| 20 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 20 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 21 #include "chrome/browser/ui/app_list/drive/drive_app_provider.h" |
| 21 #include "chrome/browser/ui/app_list/extension_app_item.h" | 22 #include "chrome/browser/ui/app_list/extension_app_item.h" |
| 22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 23 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 24 #include "extensions/browser/extension_prefs.h" | 25 #include "extensions/browser/extension_prefs.h" |
| 25 #include "extensions/browser/extension_system.h" | 26 #include "extensions/browser/extension_system.h" |
| 26 #include "extensions/browser/extensions_browser_client.h" | 27 #include "extensions/browser/extensions_browser_client.h" |
| 27 #include "extensions/browser/pref_names.h" | 28 #include "extensions/browser/pref_names.h" |
| 28 #include "extensions/common/extension.h" | 29 #include "extensions/common/extension.h" |
| 29 #include "extensions/common/extension_set.h" | 30 #include "extensions/common/extension_set.h" |
| 30 #include "ui/gfx/image/image_skia.h" | 31 #include "ui/gfx/image/image_skia.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 void ExtensionAppModelBuilder::BuildModel() { | 204 void ExtensionAppModelBuilder::BuildModel() { |
| 204 DCHECK(!tracker_); | 205 DCHECK(!tracker_); |
| 205 tracker_ = controller_->GetInstallTrackerFor(profile_); | 206 tracker_ = controller_->GetInstallTrackerFor(profile_); |
| 206 | 207 |
| 207 PopulateApps(); | 208 PopulateApps(); |
| 208 UpdateHighlight(); | 209 UpdateHighlight(); |
| 209 | 210 |
| 210 // Start observing after model is built. | 211 // Start observing after model is built. |
| 211 if (tracker_) | 212 if (tracker_) |
| 212 tracker_->AddObserver(this); | 213 tracker_->AddObserver(this); |
| 214 |
| 215 drive_app_provider_.reset(new DriveAppProvider(profile_, model_)); |
| 213 } | 216 } |
| 214 | 217 |
| 215 void ExtensionAppModelBuilder::PopulateApps() { | 218 void ExtensionAppModelBuilder::PopulateApps() { |
| 216 extensions::ExtensionSet extensions; | 219 extensions::ExtensionSet extensions; |
| 217 controller_->GetApps(profile_, &extensions); | 220 controller_->GetApps(profile_, &extensions); |
| 218 | 221 |
| 219 for (extensions::ExtensionSet::const_iterator app = extensions.begin(); | 222 for (extensions::ExtensionSet::const_iterator app = extensions.begin(); |
| 220 app != extensions.end(); ++app) { | 223 app != extensions.end(); ++app) { |
| 221 if (!extensions::ui_util::ShouldDisplayInAppLauncher(*app, profile_)) | 224 if (!extensions::ui_util::ShouldDisplayInAppLauncher(*app, profile_)) |
| 222 continue; | 225 continue; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 app_list::AppListItem* item = item_list->item_at(idx + 1); | 297 app_list::AppListItem* item = item_list->item_at(idx + 1); |
| 295 if (item->GetItemType() == ExtensionAppItem::kItemType) { | 298 if (item->GetItemType() == ExtensionAppItem::kItemType) { |
| 296 next = static_cast<ExtensionAppItem*>(item); | 299 next = static_cast<ExtensionAppItem*>(item); |
| 297 break; | 300 break; |
| 298 } | 301 } |
| 299 } | 302 } |
| 300 // item->Move will call set_position, overriding the item's position. | 303 // item->Move will call set_position, overriding the item's position. |
| 301 if (prev || next) | 304 if (prev || next) |
| 302 static_cast<ExtensionAppItem*>(item)->Move(prev, next); | 305 static_cast<ExtensionAppItem*>(item)->Move(prev, next); |
| 303 } | 306 } |
| OLD | NEW |