OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |