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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 continue; | 278 continue; |
279 InsertApp(CreateAppItem((*app)->id(), | 279 InsertApp(CreateAppItem((*app)->id(), |
280 "", | 280 "", |
281 gfx::ImageSkia(), | 281 gfx::ImageSkia(), |
282 (*app)->is_platform_app())); | 282 (*app)->is_platform_app())); |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 void ExtensionAppModelBuilder::InsertApp(scoped_ptr<ExtensionAppItem> app) { | 286 void ExtensionAppModelBuilder::InsertApp(scoped_ptr<ExtensionAppItem> app) { |
287 if (service_) { | 287 if (service_) { |
288 service_->AddItem(app.PassAs<app_list::AppListItem>()); | 288 service_->AddItem(app.Pass()); |
289 return; | 289 return; |
290 } | 290 } |
291 model_->AddItem(app.PassAs<app_list::AppListItem>()); | 291 model_->AddItem(app.Pass()); |
292 } | 292 } |
293 | 293 |
294 ExtensionAppItem* ExtensionAppModelBuilder::GetExtensionAppItem( | 294 ExtensionAppItem* ExtensionAppModelBuilder::GetExtensionAppItem( |
295 const std::string& extension_id) { | 295 const std::string& extension_id) { |
296 app_list::AppListItem* item = model_->FindItem(extension_id); | 296 app_list::AppListItem* item = model_->FindItem(extension_id); |
297 LOG_IF(ERROR, item && | 297 LOG_IF(ERROR, item && |
298 item->GetItemType() != ExtensionAppItem::kItemType) | 298 item->GetItemType() != ExtensionAppItem::kItemType) |
299 << "App Item matching id: " << extension_id | 299 << "App Item matching id: " << extension_id |
300 << " has incorrect type: '" << item->GetItemType() << "'"; | 300 << " has incorrect type: '" << item->GetItemType() << "'"; |
301 return static_cast<ExtensionAppItem*>(item); | 301 return static_cast<ExtensionAppItem*>(item); |
(...skipping 23 matching lines...) Expand all Loading... |
325 app_list::AppListItem* item = item_list->item_at(idx + 1); | 325 app_list::AppListItem* item = item_list->item_at(idx + 1); |
326 if (item->GetItemType() == ExtensionAppItem::kItemType) { | 326 if (item->GetItemType() == ExtensionAppItem::kItemType) { |
327 next = static_cast<ExtensionAppItem*>(item); | 327 next = static_cast<ExtensionAppItem*>(item); |
328 break; | 328 break; |
329 } | 329 } |
330 } | 330 } |
331 // item->Move will call set_position, overriding the item's position. | 331 // item->Move will call set_position, overriding the item's position. |
332 if (prev || next) | 332 if (prev || next) |
333 static_cast<ExtensionAppItem*>(item)->Move(prev, next); | 333 static_cast<ExtensionAppItem*>(item)->Move(prev, next); |
334 } | 334 } |
OLD | NEW |