| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 app_list::AppListView* DemoAppListViewDelegate::InitView( | 55 app_list::AppListView* DemoAppListViewDelegate::InitView( |
| 56 gfx::NativeWindow window_context) { | 56 gfx::NativeWindow window_context) { |
| 57 // On Ash, the app list is placed into an aura::Window container. For the demo | 57 // On Ash, the app list is placed into an aura::Window container. For the demo |
| 58 // use the root window context as the parent. This only works on Aura since an | 58 // use the root window context as the parent. This only works on Aura since an |
| 59 // aura::Window is also a NativeView. | 59 // aura::Window is also a NativeView. |
| 60 gfx::NativeView container = window_context; | 60 gfx::NativeView container = window_context; |
| 61 | 61 |
| 62 view_ = new app_list::AppListView(this); | 62 view_ = new app_list::AppListView(this); |
| 63 view_->InitAsBubble(container, 0); | 63 view_->Initialize(container, 0); |
| 64 view_->SetAnchorPoint(gfx::Point(300, 300)); | 64 view_->MaybeSetAnchorPoint(gfx::Point(300, 300)); |
| 65 | 65 |
| 66 // Populate some apps. | 66 // Populate some apps. |
| 67 GetTestModel()->PopulateApps(kInitialItems); | 67 GetTestModel()->PopulateApps(kInitialItems); |
| 68 app_list::AppListItemList* item_list = GetTestModel()->top_level_item_list(); | 68 app_list::AppListItemList* item_list = GetTestModel()->top_level_item_list(); |
| 69 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 69 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 70 gfx::Image test_image = rb.GetImageNamed(IDR_DEFAULT_FAVICON_32); | 70 gfx::Image test_image = rb.GetImageNamed(IDR_DEFAULT_FAVICON_32); |
| 71 for (size_t i = 0; i < item_list->item_count(); ++i) { | 71 for (size_t i = 0; i < item_list->item_count(); ++i) { |
| 72 app_list::AppListItem* item = item_list->item_at(i); | 72 app_list::AppListItem* item = item_list->item_at(i); |
| 73 // Alternate images with shadows and images without. | 73 // Alternate images with shadows and images without. |
| 74 item->SetIcon(*test_image.ToImageSkia()); | 74 item->SetIcon(*test_image.ToImageSkia()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace | 113 } // namespace |
| 114 | 114 |
| 115 int main(int argc, const char** argv) { | 115 int main(int argc, const char** argv) { |
| 116 ui::ViewsContentClient views_content_client(argc, argv); | 116 ui::ViewsContentClient views_content_client(argc, argv); |
| 117 | 117 |
| 118 views_content_client.set_task(base::Bind(&ShowAppList)); | 118 views_content_client.set_task(base::Bind(&ShowAppList)); |
| 119 return views_content_client.RunMain(); | 119 return views_content_client.RunMain(); |
| 120 } | 120 } |
| OLD | NEW |