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 "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" |
7 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
8 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 10 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
9 #include "chrome/browser/ui/app_list/apps_model_builder.h" | 11 #include "chrome/browser/ui/app_list/apps_model_builder.h" |
10 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" | 12 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" |
11 #include "chrome/browser/ui/app_list/chrome_signin_delegate.h" | 13 #include "chrome/browser/ui/app_list/chrome_signin_delegate.h" |
12 #include "chrome/browser/ui/app_list/search_builder.h" | 14 #include "chrome/browser/ui/app_list/search_builder.h" |
| 15 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/chrome_pages.h" |
| 17 #include "chrome/browser/ui/host_desktop.h" |
| 18 #include "chrome/common/extensions/extension_constants.h" |
13 #include "content/public/browser/user_metrics.h" | 19 #include "content/public/browser/user_metrics.h" |
14 | 20 |
15 #if defined(USE_ASH) | 21 #if defined(USE_ASH) |
16 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" | 22 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" |
17 #endif | 23 #endif |
18 | 24 |
19 AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller, | 25 AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller, |
20 Profile* profile) | 26 Profile* profile) |
21 : controller_(controller), | 27 : controller_(controller), |
22 profile_(profile) {} | 28 profile_(profile) {} |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 controller_->ViewClosing(); | 100 controller_->ViewClosing(); |
95 } | 101 } |
96 | 102 |
97 void AppListViewDelegate::ViewActivationChanged(bool active) { | 103 void AppListViewDelegate::ViewActivationChanged(bool active) { |
98 controller_->ViewActivationChanged(active); | 104 controller_->ViewActivationChanged(active); |
99 } | 105 } |
100 | 106 |
101 gfx::ImageSkia AppListViewDelegate::GetWindowIcon() { | 107 gfx::ImageSkia AppListViewDelegate::GetWindowIcon() { |
102 return controller_->GetWindowIcon(); | 108 return controller_->GetWindowIcon(); |
103 } | 109 } |
| 110 |
| 111 string16 AppListViewDelegate::GetCurrentUserName() { |
| 112 ProfileInfoCache& cache = |
| 113 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 114 int profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); |
| 115 return cache.GetNameOfProfileAtIndex(profile_index); |
| 116 } |
| 117 |
| 118 string16 AppListViewDelegate::GetCurrentUserEmail() { |
| 119 ProfileInfoCache& cache = |
| 120 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 121 int profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); |
| 122 return cache.GetUserNameOfProfileAtIndex(profile_index); |
| 123 } |
| 124 |
| 125 void AppListViewDelegate::OpenSettings() { |
| 126 ExtensionService* service = profile_->GetExtensionService(); |
| 127 DCHECK(service); |
| 128 const extensions::Extension* extension = service->GetInstalledExtension( |
| 129 extension_misc::kSettingsAppId); |
| 130 DCHECK(extension); |
| 131 controller_->ActivateApp(profile_, extension, 0); |
| 132 } |
| 133 |
| 134 void AppListViewDelegate::OpenFeedback() { |
| 135 chrome::HostDesktopType desktop = chrome::GetHostDesktopTypeForNativeWindow( |
| 136 controller_->GetAppListWindow()); |
| 137 Browser* browser = chrome::FindOrCreateTabbedBrowser( |
| 138 profile_, desktop); |
| 139 chrome::ShowFeedbackPage(browser, std::string(), std::string()); |
| 140 } |
OLD | NEW |