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

Side by Side Diff: ui/app_list/views/app_list_main_view.h

Issue 334293005: Fix use-after-free when switching profiles in the experimental app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_VIEWS_APP_LIST_MAIN_VIEW_H_ 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_
6 #define UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_ 6 #define UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "ui/app_list/app_list_export.h" 13 #include "ui/app_list/app_list_export.h"
14 #include "ui/app_list/views/apps_grid_view_delegate.h" 14 #include "ui/app_list/views/apps_grid_view_delegate.h"
15 #include "ui/app_list/views/search_box_view_delegate.h" 15 #include "ui/app_list/views/search_box_view_delegate.h"
16 #include "ui/app_list/views/search_result_list_view_delegate.h" 16 #include "ui/app_list/views/search_result_list_view_delegate.h"
17 #include "ui/views/view.h" 17 #include "ui/views/view.h"
18 18
19 namespace views { 19 namespace views {
20 class Widget; 20 class Widget;
21 } 21 }
22 22
23 namespace app_list { 23 namespace app_list {
24 24
25 class AppListItem; 25 class AppListItem;
26 class AppListModel; 26 class AppListModel;
27 class AppListViewDelegate; 27 class AppListViewDelegate;
28 class ApplicationDragAndDropHost; 28 class ApplicationDragAndDropHost;
29 class ContentsView; 29 class ContentsView;
30 class ContentsSwitcherView;
30 class PaginationModel; 31 class PaginationModel;
31 class SearchBoxView; 32 class SearchBoxView;
32 33
33 // AppListMainView contains the normal view of the app list, which is shown 34 // AppListMainView contains the normal view of the app list, which is shown
34 // when the user is signed in. 35 // when the user is signed in.
35 class APP_LIST_EXPORT AppListMainView : public views::View, 36 class APP_LIST_EXPORT AppListMainView : public views::View,
36 public AppsGridViewDelegate, 37 public AppsGridViewDelegate,
37 public SearchBoxViewDelegate, 38 public SearchBoxViewDelegate,
38 public SearchResultListViewDelegate { 39 public SearchResultListViewDelegate {
39 public: 40 public:
(...skipping 18 matching lines...) Expand all
58 void OnStartPageSearchButtonPressed(); 59 void OnStartPageSearchButtonPressed();
59 60
60 SearchBoxView* search_box_view() const { return search_box_view_; } 61 SearchBoxView* search_box_view() const { return search_box_view_; }
61 62
62 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop 63 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop
63 // operations outside the application list. 64 // operations outside the application list.
64 void SetDragAndDropHostOfCurrentAppList( 65 void SetDragAndDropHostOfCurrentAppList(
65 ApplicationDragAndDropHost* drag_and_drop_host); 66 ApplicationDragAndDropHost* drag_and_drop_host);
66 67
67 ContentsView* contents_view() const { return contents_view_; } 68 ContentsView* contents_view() const { return contents_view_; }
69 ContentsSwitcherView* contents_switcher_view() const {
70 return contents_switcher_view_;
71 }
68 AppListModel* model() { return model_; } 72 AppListModel* model() { return model_; }
69 73
70 // Returns true if the app list should be centered and in landscape mode. 74 // Returns true if the app list should be centered and in landscape mode.
71 bool ShouldCenterWindow() const; 75 bool ShouldCenterWindow() const;
72 76
73 private: 77 private:
74 class IconLoader; 78 class IconLoader;
75 79
76 void AddContentsView(); 80 void AddContentsView();
Matt Giuca 2014/06/17 05:49:26 Might be good to comment that this also adds the c
calamity 2014/06/17 09:15:39 Renamed to AddContentsViews(). I don't think AddCh
77 81
78 // Gets the PaginationModel owned by the AppsGridView. 82 // Gets the PaginationModel owned by the AppsGridView.
79 PaginationModel* GetAppsPaginationModel(); 83 PaginationModel* GetAppsPaginationModel();
80 84
81 // Loads icon image for the apps in the selected page of |pagination_model_|. 85 // Loads icon image for the apps in the selected page of |pagination_model_|.
82 // |parent| is used to determine the image scale factor to use. 86 // |parent| is used to determine the image scale factor to use.
83 void PreloadIcons(gfx::NativeView parent); 87 void PreloadIcons(gfx::NativeView parent);
84 88
85 // Invoked when |icon_loading_wait_timer_| fires. 89 // Invoked when |icon_loading_wait_timer_| fires.
86 void OnIconLoadingWaitTimer(); 90 void OnIconLoadingWaitTimer();
(...skipping 15 matching lines...) Expand all
102 106
103 // Overridden from SearchResultListViewDelegate: 107 // Overridden from SearchResultListViewDelegate:
104 virtual void OnResultInstalled(SearchResult* result) OVERRIDE; 108 virtual void OnResultInstalled(SearchResult* result) OVERRIDE;
105 virtual void OnResultUninstalled(SearchResult* result) OVERRIDE; 109 virtual void OnResultUninstalled(SearchResult* result) OVERRIDE;
106 110
107 AppListViewDelegate* delegate_; // Owned by parent view (AppListView). 111 AppListViewDelegate* delegate_; // Owned by parent view (AppListView).
108 AppListModel* model_; // Unowned; ownership is handled by |delegate_|. 112 AppListModel* model_; // Unowned; ownership is handled by |delegate_|.
109 113
110 SearchBoxView* search_box_view_; // Owned by views hierarchy. 114 SearchBoxView* search_box_view_; // Owned by views hierarchy.
111 ContentsView* contents_view_; // Owned by views hierarchy. 115 ContentsView* contents_view_; // Owned by views hierarchy.
116 ContentsSwitcherView* contents_switcher_view_; // Owned by views hierarchy.
Matt Giuca 2014/06/17 05:49:26 Add that it can be NULL.
calamity 2014/06/17 09:15:39 Done.
112 117
113 // A timer that fires when maximum allowed time to wait for icon loading has 118 // A timer that fires when maximum allowed time to wait for icon loading has
114 // passed. 119 // passed.
115 base::OneShotTimer<AppListMainView> icon_loading_wait_timer_; 120 base::OneShotTimer<AppListMainView> icon_loading_wait_timer_;
116 121
117 ScopedVector<IconLoader> pending_icon_loaders_; 122 ScopedVector<IconLoader> pending_icon_loaders_;
118 123
119 base::WeakPtrFactory<AppListMainView> weak_ptr_factory_; 124 base::WeakPtrFactory<AppListMainView> weak_ptr_factory_;
120 125
121 DISALLOW_COPY_AND_ASSIGN(AppListMainView); 126 DISALLOW_COPY_AND_ASSIGN(AppListMainView);
122 }; 127 };
123 128
124 } // namespace app_list 129 } // namespace app_list
125 130
126 #endif // UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_ 131 #endif // UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/views/app_list_main_view.cc » ('j') | ui/app_list/views/app_list_main_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698