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

Side by Side Diff: ui/app_list/app_list_view.h

Issue 11418312: app_list: Improve initial icon loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, stop timer when showing widget because no pending icon loads Created 8 years 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
« no previous file with comments | « ui/app_list/app_list_constants.cc ('k') | ui/app_list/app_list_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef UI_APP_LIST_APP_LIST_VIEW_H_ 5 #ifndef UI_APP_LIST_APP_LIST_VIEW_H_
6 #define UI_APP_LIST_APP_LIST_VIEW_H_ 6 #define UI_APP_LIST_APP_LIST_VIEW_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
10 #include "base/timer.h"
9 #include "ui/app_list/app_list_export.h" 11 #include "ui/app_list/app_list_export.h"
10 #include "ui/app_list/apps_grid_view_delegate.h" 12 #include "ui/app_list/apps_grid_view_delegate.h"
11 #include "ui/app_list/search_box_view_delegate.h" 13 #include "ui/app_list/search_box_view_delegate.h"
12 #include "ui/app_list/search_result_list_view_delegate.h" 14 #include "ui/app_list/search_result_list_view_delegate.h"
13 #include "ui/views/bubble/bubble_delegate.h" 15 #include "ui/views/bubble/bubble_delegate.h"
14 16
15 namespace views { 17 namespace views {
16 class Widget; 18 class Widget;
17 } 19 }
18 20
(...skipping 22 matching lines...) Expand all
41 PaginationModel* pagination_model, 43 PaginationModel* pagination_model,
42 views::View* anchor, 44 views::View* anchor,
43 const gfx::Point& anchor_point, 45 const gfx::Point& anchor_point,
44 views::BubbleBorder::ArrowLocation arrow_location); 46 views::BubbleBorder::ArrowLocation arrow_location);
45 47
46 void SetBubbleArrowLocation( 48 void SetBubbleArrowLocation(
47 views::BubbleBorder::ArrowLocation arrow_location); 49 views::BubbleBorder::ArrowLocation arrow_location);
48 50
49 void SetAnchorPoint(const gfx::Point& anchor_point); 51 void SetAnchorPoint(const gfx::Point& anchor_point);
50 52
53 // Shows the UI when there are no pending icon loads. Otherwise, starts a
54 // timer to show the UI when a maximum allowed wait time has expired.
55 void ShowWhenReady();
56
51 void Close(); 57 void Close();
52 58
53 void UpdateBounds(); 59 void UpdateBounds();
54 60
55 private: 61 private:
56 // Creates models to use. 62 class IconLoader;
57 void CreateModel(); 63
64 // Loads icon image for the apps in the selected page of |pagination_model|.
65 // |anchor| is used to determine the image scale factor to use.
66 void PreloadIcons(PaginationModel* pagination_model,
67 views::View* anchor);
68
69 // Invoked when |icon_loading_wait_timer_| fires.
70 void OnIconLoadingWaitTimer();
71
72 // Invoked from an IconLoader when icon loading is finished.
73 void OnItemIconLoaded(IconLoader* loader);
58 74
59 // Overridden from views::WidgetDelegateView: 75 // Overridden from views::WidgetDelegateView:
60 virtual views::View* GetInitiallyFocusedView() OVERRIDE; 76 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
61 virtual bool WidgetHasHitTestMask() const OVERRIDE; 77 virtual bool WidgetHasHitTestMask() const OVERRIDE;
62 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; 78 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE;
63 79
64 // Overridden from views::View: 80 // Overridden from views::View:
65 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 81 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
66 82
67 // Overridden from AppsGridViewDelegate: 83 // Overridden from AppsGridViewDelegate:
(...skipping 13 matching lines...) Expand all
81 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; 97 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
82 virtual void OnWidgetActivationChanged(views::Widget* widget, bool active) 98 virtual void OnWidgetActivationChanged(views::Widget* widget, bool active)
83 OVERRIDE; 99 OVERRIDE;
84 100
85 scoped_ptr<AppListModel> model_; 101 scoped_ptr<AppListModel> model_;
86 scoped_ptr<AppListViewDelegate> delegate_; 102 scoped_ptr<AppListViewDelegate> delegate_;
87 103
88 SearchBoxView* search_box_view_; // Owned by views hierarchy. 104 SearchBoxView* search_box_view_; // Owned by views hierarchy.
89 ContentsView* contents_view_; // Owned by views hierarchy. 105 ContentsView* contents_view_; // Owned by views hierarchy.
90 106
107 // A timer that fires when maximum allowed time to wait for icon loading has
108 // passed.
109 base::OneShotTimer<AppListView> icon_loading_wait_timer_;
110
111 ScopedVector<IconLoader> pending_icon_loaders_;
112
91 DISALLOW_COPY_AND_ASSIGN(AppListView); 113 DISALLOW_COPY_AND_ASSIGN(AppListView);
92 }; 114 };
93 115
94 } // namespace app_list 116 } // namespace app_list
95 117
96 #endif // UI_APP_LIST_APP_LIST_VIEW_H_ 118 #endif // UI_APP_LIST_APP_LIST_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/app_list_constants.cc ('k') | ui/app_list/app_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698