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" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/feedback/feedback_util.h" | 15 #include "chrome/browser/feedback/feedback_util.h" |
16 #include "chrome/browser/profiles/profile_info_cache.h" | 16 #include "chrome/browser/profiles/profile_info_cache.h" |
| 17 #include "chrome/browser/profiles/profile_info_entry.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 19 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
19 #include "chrome/browser/ui/app_list/extension_app_model_builder.h" | 20 #include "chrome/browser/ui/app_list/extension_app_model_builder.h" |
20 #include "chrome/browser/ui/app_list/search/search_controller.h" | 21 #include "chrome/browser/ui/app_list/search/search_controller.h" |
21 #include "chrome/browser/ui/app_list/start_page_service.h" | 22 #include "chrome/browser/ui/app_list/start_page_service.h" |
22 #include "chrome/browser/ui/browser_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
23 #include "chrome/browser/ui/chrome_pages.h" | 24 #include "chrome/browser/ui/chrome_pages.h" |
24 #include "chrome/browser/ui/host_desktop.h" | 25 #include "chrome/browser/ui/host_desktop.h" |
25 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 26 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
26 #include "chrome/browser/web_applications/web_app.h" | 27 #include "chrome/browser/web_applications/web_app.h" |
(...skipping 25 matching lines...) Expand all Loading... |
52 content::BrowserThread::FILE, | 53 content::BrowserThread::FILE, |
53 FROM_HERE, | 54 FROM_HERE, |
54 base::Bind(web_app::CreateShortcutInWebAppDir, app_data_dir, info), | 55 base::Bind(web_app::CreateShortcutInWebAppDir, app_data_dir, info), |
55 callback); | 56 callback); |
56 } | 57 } |
57 #endif | 58 #endif |
58 | 59 |
59 void PopulateUsers(const ProfileInfoCache& profile_info, | 60 void PopulateUsers(const ProfileInfoCache& profile_info, |
60 const base::FilePath& active_profile_path, | 61 const base::FilePath& active_profile_path, |
61 app_list::AppListModel::Users* users) { | 62 app_list::AppListModel::Users* users) { |
62 const size_t count = profile_info.GetNumberOfProfiles(); | 63 |
63 for (size_t i = 0; i < count; ++i) { | 64 const std::vector<ProfileInfoEntry> entries( |
64 // Don't display managed users. | 65 profile_info.GetProfilesSortedByName()); |
65 if (profile_info.ProfileIsManagedAtIndex(i)) | 66 |
| 67 for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
| 68 it != entries.end(); ++it) { |
| 69 if (it->IsManaged()) |
66 continue; | 70 continue; |
67 | 71 |
68 app_list::AppListModel::User user; | 72 app_list::AppListModel::User user; |
69 user.name = profile_info.GetNameOfProfileAtIndex(i); | 73 user.name = it->GetDisplayName(); |
70 user.email = profile_info.GetUserNameOfProfileAtIndex(i); | 74 user.email = it->user_name(); |
71 user.profile_path = profile_info.GetPathOfProfileAtIndex(i); | 75 user.profile_path = it->path(); |
72 user.active = active_profile_path == user.profile_path; | 76 user.active = active_profile_path == user.profile_path; |
73 users->push_back(user); | 77 users->push_back(user); |
74 } | 78 } |
75 } | 79 } |
76 | 80 |
77 } // namespace | 81 } // namespace |
78 | 82 |
79 AppListViewDelegate::AppListViewDelegate( | 83 AppListViewDelegate::AppListViewDelegate( |
80 scoped_ptr<AppListControllerDelegate> controller, | 84 scoped_ptr<AppListControllerDelegate> controller, |
81 Profile* profile) | 85 Profile* profile) |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 293 } |
290 | 294 |
291 content::WebContents* AppListViewDelegate::GetStartPageContents() { | 295 content::WebContents* AppListViewDelegate::GetStartPageContents() { |
292 app_list::StartPageService* service = | 296 app_list::StartPageService* service = |
293 app_list::StartPageService::Get(profile_); | 297 app_list::StartPageService::Get(profile_); |
294 if (!service) | 298 if (!service) |
295 return NULL; | 299 return NULL; |
296 | 300 |
297 return service->contents(); | 301 return service->contents(); |
298 } | 302 } |
OLD | NEW |