Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: ui/app_list/views/app_list_demo.cc

Issue 302803002: Refactor app list so AppsGridView owns the PaginationModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error (conflict). Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
11 #include "grit/ui_resources.h" 11 #include "grit/ui_resources.h"
12 #include "ui/app_list/pagination_model.h"
13 #include "ui/app_list/test/app_list_test_model.h" 12 #include "ui/app_list/test/app_list_test_model.h"
14 #include "ui/app_list/test/app_list_test_view_delegate.h" 13 #include "ui/app_list/test/app_list_test_view_delegate.h"
15 #include "ui/app_list/views/app_list_view.h" 14 #include "ui/app_list/views/app_list_view.h"
16 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/views_content_client/views_content_client.h" 16 #include "ui/views_content_client/views_content_client.h"
18 17
19 #if defined(OS_WIN) 18 #if defined(OS_WIN)
20 #include "content/public/app/startup_helper_win.h" 19 #include "content/public/app/startup_helper_win.h"
21 #include "sandbox/win/src/sandbox_types.h" 20 #include "sandbox/win/src/sandbox_types.h"
22 #endif 21 #endif
(...skipping 14 matching lines...) Expand all
37 virtual ~DemoAppListViewDelegate() {} 36 virtual ~DemoAppListViewDelegate() {}
38 37
39 app_list::AppListView* InitView(gfx::NativeView window_context); 38 app_list::AppListView* InitView(gfx::NativeView window_context);
40 39
41 // Overridden from AppListViewDelegate: 40 // Overridden from AppListViewDelegate:
42 virtual void Dismiss() OVERRIDE; 41 virtual void Dismiss() OVERRIDE;
43 virtual void ViewClosing() OVERRIDE; 42 virtual void ViewClosing() OVERRIDE;
44 virtual content::WebContents* GetStartPageContents() OVERRIDE; 43 virtual content::WebContents* GetStartPageContents() OVERRIDE;
45 44
46 private: 45 private:
47 app_list::PaginationModel pagination_model_;
48 app_list::AppListView* view_; // Weak. Owns this. 46 app_list::AppListView* view_; // Weak. Owns this.
49 content::BrowserContext* browser_context_; 47 content::BrowserContext* browser_context_;
50 scoped_ptr<content::WebContents> web_contents_; 48 scoped_ptr<content::WebContents> web_contents_;
51 49
52 DISALLOW_COPY_AND_ASSIGN(DemoAppListViewDelegate); 50 DISALLOW_COPY_AND_ASSIGN(DemoAppListViewDelegate);
53 }; 51 };
54 52
55 app_list::AppListView* DemoAppListViewDelegate::InitView( 53 app_list::AppListView* DemoAppListViewDelegate::InitView(
56 gfx::NativeView window_context) { 54 gfx::NativeView window_context) {
57 // Note AppListView takes ownership of |this| on the next line. 55 // Note AppListView takes ownership of |this| on the next line.
58 view_ = new app_list::AppListView(this); 56 view_ = new app_list::AppListView(this);
59 view_->InitAsBubbleAtFixedLocation(window_context, 57 view_->InitAsBubbleAtFixedLocation(window_context,
60 &pagination_model_, 58 0,
61 gfx::Point(300, 300), 59 gfx::Point(300, 300),
62 views::BubbleBorder::FLOAT, 60 views::BubbleBorder::FLOAT,
63 false /* border_accepts_events */); 61 false /* border_accepts_events */);
64 62
65 // Populate some apps. 63 // Populate some apps.
66 GetTestModel()->PopulateApps(kInitialItems); 64 GetTestModel()->PopulateApps(kInitialItems);
67 app_list::AppListItemList* item_list = GetTestModel()->top_level_item_list(); 65 app_list::AppListItemList* item_list = GetTestModel()->top_level_item_list();
68 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 66 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
69 gfx::Image test_image = rb.GetImageNamed(IDR_DEFAULT_FAVICON_32); 67 gfx::Image test_image = rb.GetImageNamed(IDR_DEFAULT_FAVICON_32);
70 for (size_t i = 0; i < item_list->item_count(); ++i) { 68 for (size_t i = 0; i < item_list->item_count(); ++i) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 content::InitializeSandboxInfo(&sandbox_info); 110 content::InitializeSandboxInfo(&sandbox_info);
113 ui::ViewsContentClient views_content_client(instance, &sandbox_info); 111 ui::ViewsContentClient views_content_client(instance, &sandbox_info);
114 #else 112 #else
115 int main(int argc, const char** argv) { 113 int main(int argc, const char** argv) {
116 ui::ViewsContentClient views_content_client(argc, argv); 114 ui::ViewsContentClient views_content_client(argc, argv);
117 #endif 115 #endif
118 116
119 views_content_client.set_task(base::Bind(&ShowAppList)); 117 views_content_client.set_task(base::Bind(&ShowAppList));
120 return views_content_client.RunMain(); 118 return views_content_client.RunMain();
121 } 119 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_shower_views.cc ('k') | ui/app_list/views/app_list_folder_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698