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_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 18 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
19 #include "chrome/browser/ui/app_list/apps_model_builder.h" | 19 #include "chrome/browser/ui/app_list/apps_model_builder.h" |
20 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" | |
21 #include "chrome/browser/ui/app_list/search/search_controller.h" | 20 #include "chrome/browser/ui/app_list/search/search_controller.h" |
22 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
23 #include "chrome/browser/ui/chrome_pages.h" | 22 #include "chrome/browser/ui/chrome_pages.h" |
24 #include "chrome/browser/ui/host_desktop.h" | 23 #include "chrome/browser/ui/host_desktop.h" |
25 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 24 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
26 #include "chrome/browser/web_applications/web_app.h" | 25 #include "chrome/browser/web_applications/web_app.h" |
27 #include "chrome/common/extensions/extension_constants.h" | 26 #include "chrome/common/extensions/extension_constants.h" |
28 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
29 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
30 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 controller_.get())); | 155 controller_.get())); |
157 | 156 |
158 // Initialize the profile information in the app list menu. | 157 // Initialize the profile information in the app list menu. |
159 OnProfileChanged(); | 158 OnProfileChanged(); |
160 } | 159 } |
161 | 160 |
162 app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { | 161 app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { |
163 return &signin_delegate_; | 162 return &signin_delegate_; |
164 } | 163 } |
165 | 164 |
166 void AppListViewDelegate::ActivateAppListItem( | |
167 app_list::AppListItemModel* item, | |
168 int event_flags) { | |
169 content::RecordAction(content::UserMetricsAction("AppList_ClickOnApp")); | |
170 static_cast<ChromeAppListItem*>(item)->Activate(event_flags); | |
171 } | |
172 | |
173 void AppListViewDelegate::GetShortcutPathForApp( | 165 void AppListViewDelegate::GetShortcutPathForApp( |
174 const std::string& app_id, | 166 const std::string& app_id, |
175 const base::Callback<void(const base::FilePath&)>& callback) { | 167 const base::Callback<void(const base::FilePath&)>& callback) { |
176 #if defined(OS_WIN) | 168 #if defined(OS_WIN) |
177 ExtensionService* service = profile_->GetExtensionService(); | 169 ExtensionService* service = profile_->GetExtensionService(); |
178 DCHECK(service); | 170 DCHECK(service); |
179 const extensions::Extension* extension = | 171 const extensions::Extension* extension = |
180 service->GetInstalledExtension(app_id); | 172 service->GetInstalledExtension(app_id); |
181 if (!extension) { | 173 if (!extension) { |
182 callback.Run(base::FilePath()); | 174 callback.Run(base::FilePath()); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 void AppListViewDelegate::OnProfileWasRemoved( | 276 void AppListViewDelegate::OnProfileWasRemoved( |
285 const base::FilePath& profile_path, const base::string16& profile_name) { | 277 const base::FilePath& profile_path, const base::string16& profile_name) { |
286 OnProfileChanged(); | 278 OnProfileChanged(); |
287 } | 279 } |
288 | 280 |
289 void AppListViewDelegate::OnProfileNameChanged( | 281 void AppListViewDelegate::OnProfileNameChanged( |
290 const base::FilePath& profile_path, | 282 const base::FilePath& profile_path, |
291 const base::string16& old_profile_name) { | 283 const base::string16& old_profile_name) { |
292 OnProfileChanged(); | 284 OnProfileChanged(); |
293 } | 285 } |
OLD | NEW |