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

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

Issue 63283003: Move AppListModel::Users to AppListViewDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac fixes Created 7 years, 1 month 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 | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | ui/app_list/app_list.gyp » ('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 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 content::BrowserThread::PostTaskAndReplyWithResult( 52 content::BrowserThread::PostTaskAndReplyWithResult(
53 content::BrowserThread::FILE, 53 content::BrowserThread::FILE,
54 FROM_HERE, 54 FROM_HERE,
55 base::Bind(web_app::CreateShortcutInWebAppDir, app_data_dir, info), 55 base::Bind(web_app::CreateShortcutInWebAppDir, app_data_dir, info),
56 callback); 56 callback);
57 } 57 }
58 #endif 58 #endif
59 59
60 void PopulateUsers(const ProfileInfoCache& profile_info, 60 void PopulateUsers(const ProfileInfoCache& profile_info,
61 const base::FilePath& active_profile_path, 61 const base::FilePath& active_profile_path,
62 app_list::AppListModel::Users* users) { 62 app_list::AppListViewDelegate::Users* users) {
63 const size_t count = profile_info.GetNumberOfProfiles(); 63 const size_t count = profile_info.GetNumberOfProfiles();
64 for (size_t i = 0; i < count; ++i) { 64 for (size_t i = 0; i < count; ++i) {
65 // Don't display managed users. 65 // Don't display managed users.
66 if (profile_info.ProfileIsManagedAtIndex(i)) 66 if (profile_info.ProfileIsManagedAtIndex(i))
67 continue; 67 continue;
68 68
69 app_list::AppListModel::User user; 69 app_list::AppListViewDelegate::User user;
70 user.name = profile_info.GetNameOfProfileAtIndex(i); 70 user.name = profile_info.GetNameOfProfileAtIndex(i);
71 user.email = profile_info.GetUserNameOfProfileAtIndex(i); 71 user.email = profile_info.GetUserNameOfProfileAtIndex(i);
72 user.profile_path = profile_info.GetPathOfProfileAtIndex(i); 72 user.profile_path = profile_info.GetPathOfProfileAtIndex(i);
73 user.active = active_profile_path == user.profile_path; 73 user.active = active_profile_path == user.profile_path;
74 users->push_back(user); 74 users->push_back(user);
75 } 75 }
76 } 76 }
77 77
78 } // namespace 78 } // namespace
79 79
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 model_->SetSignedIn(!GetSigninDelegate()->NeedSignin()); 119 model_->SetSignedIn(!GetSigninDelegate()->NeedSignin());
120 120
121 // Don't populate the app list users if we are on the ash desktop. 121 // Don't populate the app list users if we are on the ash desktop.
122 chrome::HostDesktopType desktop = chrome::GetHostDesktopTypeForNativeWindow( 122 chrome::HostDesktopType desktop = chrome::GetHostDesktopTypeForNativeWindow(
123 controller_->GetAppListWindow()); 123 controller_->GetAppListWindow());
124 if (desktop == chrome::HOST_DESKTOP_TYPE_ASH) 124 if (desktop == chrome::HOST_DESKTOP_TYPE_ASH)
125 return; 125 return;
126 126
127 // Populate the app list users. 127 // Populate the app list users.
128 app_list::AppListModel::Users users;
129 PopulateUsers(g_browser_process->profile_manager()->GetProfileInfoCache(), 128 PopulateUsers(g_browser_process->profile_manager()->GetProfileInfoCache(),
130 profile_->GetPath(), &users); 129 profile_->GetPath(), &users_);
131 model_->SetUsers(users);
132 } 130 }
133 131
134 void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) { 132 void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) {
135 DCHECK(model_); 133 DCHECK(model_);
136 134
137 // The profile must be loaded before this is called. 135 // The profile must be loaded before this is called.
138 profile_ = 136 profile_ =
139 g_browser_process->profile_manager()->GetProfileByPath(profile_path); 137 g_browser_process->profile_manager()->GetProfileByPath(profile_path);
140 DCHECK(profile_); 138 DCHECK(profile_);
141 139
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 287 }
290 288
291 content::WebContents* AppListViewDelegate::GetStartPageContents() { 289 content::WebContents* AppListViewDelegate::GetStartPageContents() {
292 app_list::StartPageService* service = 290 app_list::StartPageService* service =
293 app_list::StartPageService::Get(profile_); 291 app_list::StartPageService::Get(profile_);
294 if (!service) 292 if (!service)
295 return NULL; 293 return NULL;
296 294
297 return service->contents(); 295 return service->contents();
298 } 296 }
297
298 const app_list::AppListViewDelegate::Users&
299 AppListViewDelegate::GetUsers() const {
300 return users_;
301 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | ui/app_list/app_list.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698