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

Side by Side Diff: chrome/browser/ui/app_list/app_list_view_delegate.h

Issue 492163002: Fix Profile* lifetime issues in Chrome's AppListViewDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add constructor comment Created 6 years, 3 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 (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 CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 class AppSyncUIStateWatcher; 45 class AppSyncUIStateWatcher;
46 #endif 46 #endif
47 47
48 class AppListViewDelegate : public app_list::AppListViewDelegate, 48 class AppListViewDelegate : public app_list::AppListViewDelegate,
49 public app_list::StartPageObserver, 49 public app_list::StartPageObserver,
50 public HotwordClient, 50 public HotwordClient,
51 public ProfileInfoCacheObserver, 51 public ProfileInfoCacheObserver,
52 public SigninManagerBase::Observer, 52 public SigninManagerBase::Observer,
53 public SigninManagerFactory::Observer { 53 public SigninManagerFactory::Observer {
54 public: 54 public:
55 // Constructs Chrome's AppListViewDelegate, initially for |profile|.
56 // Does not take ownership of |controller|. TODO(tapted): It should.
55 AppListViewDelegate(Profile* profile, 57 AppListViewDelegate(Profile* profile,
56 AppListControllerDelegate* controller); 58 AppListControllerDelegate* controller);
57 virtual ~AppListViewDelegate(); 59 virtual ~AppListViewDelegate();
58 60
59 private: 61 private:
60 // Updates the app list's current profile and ProfileMenuItems. 62 // Configure the AppList for the given |profile|.
61 void OnProfileChanged(); 63 void SetProfile(Profile* profile);
64
65 // Updates the speech webview and start page for the current |profile_|.
66 void SetUpSearchUI();
67
68 // Updates the app list's ProfileMenuItems for the current |profile_|.
69 void SetUpProfileSwitcher();
70
71 // Updates the app list's custom launcher pages for the current |profile_|.
72 void SetUpCustomLauncherPages();
62 73
63 // Overridden from app_list::AppListViewDelegate: 74 // Overridden from app_list::AppListViewDelegate:
64 virtual bool ForceNativeDesktop() const OVERRIDE; 75 virtual bool ForceNativeDesktop() const OVERRIDE;
65 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE; 76 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE;
66 virtual app_list::AppListModel* GetModel() OVERRIDE; 77 virtual app_list::AppListModel* GetModel() OVERRIDE;
67 virtual app_list::SpeechUIModel* GetSpeechUI() OVERRIDE; 78 virtual app_list::SpeechUIModel* GetSpeechUI() OVERRIDE;
68 virtual void GetShortcutPathForApp( 79 virtual void GetShortcutPathForApp(
69 const std::string& app_id, 80 const std::string& app_id,
70 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; 81 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE;
71 virtual void StartSearch() OVERRIDE; 82 virtual void StartSearch() OVERRIDE;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 virtual void GoogleSignedOut(const std::string& username) OVERRIDE; 134 virtual void GoogleSignedOut(const std::string& username) OVERRIDE;
124 135
125 // Overridden from ProfileInfoCacheObserver: 136 // Overridden from ProfileInfoCacheObserver:
126 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; 137 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE;
127 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, 138 virtual void OnProfileWasRemoved(const base::FilePath& profile_path,
128 const base::string16& profile_name) OVERRIDE; 139 const base::string16& profile_name) OVERRIDE;
129 virtual void OnProfileNameChanged( 140 virtual void OnProfileNameChanged(
130 const base::FilePath& profile_path, 141 const base::FilePath& profile_path,
131 const base::string16& old_profile_name) OVERRIDE; 142 const base::string16& old_profile_name) OVERRIDE;
132 143
133 scoped_ptr<app_list::SearchController> search_controller_;
134 // Unowned pointer to the controller. 144 // Unowned pointer to the controller.
135 AppListControllerDelegate* controller_; 145 AppListControllerDelegate* controller_;
136 // Unowned pointer to the associated profile. May change if SetProfileByPath 146 // Unowned pointer to the associated profile. May change if SetProfileByPath
137 // is called. 147 // is called.
138 Profile* profile_; 148 Profile* profile_;
139 // Unowned pointer to the model owned by AppListSyncableService. Will change 149 // Unowned pointer to the model owned by AppListSyncableService. Will change
140 // if |profile_| changes. 150 // if |profile_| changes.
141 app_list::AppListModel* model_; 151 app_list::AppListModel* model_;
142 152
153 // Note: order ensures |search_controller_| is destroyed before |speech_ui_|.
143 scoped_ptr<app_list::SpeechUIModel> speech_ui_; 154 scoped_ptr<app_list::SpeechUIModel> speech_ui_;
155 scoped_ptr<app_list::SearchController> search_controller_;
144 156
145 base::TimeDelta auto_launch_timeout_; 157 base::TimeDelta auto_launch_timeout_;
146 158
147 Users users_; 159 Users users_;
148 160
149 #if defined(USE_ASH) 161 #if defined(USE_ASH)
150 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; 162 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_;
151 #endif 163 #endif
152 164
153 ObserverList<app_list::AppListViewDelegateObserver> observers_; 165 ObserverList<app_list::AppListViewDelegateObserver> observers_;
154 166
155 // Used to track the SigninManagers that this instance is observing so that 167 // Used to track the SigninManagers that this instance is observing so that
156 // this instance can be removed as an observer on its destruction. 168 // this instance can be removed as an observer on its destruction.
157 ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_; 169 ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_;
158 170
159 // Window contents of additional custom launcher pages. 171 // Window contents of additional custom launcher pages.
160 ScopedVector<apps::CustomLauncherPageContents> custom_page_contents_; 172 ScopedVector<apps::CustomLauncherPageContents> custom_page_contents_;
161 173
162 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); 174 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate);
163 }; 175 };
164 176
165 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ 177 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_views.cc ('k') | chrome/browser/ui/app_list/app_list_view_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698