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