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 "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 | 96 |
97 void AppListViewDelegate::GetShortcutPathForApp( | 97 void AppListViewDelegate::GetShortcutPathForApp( |
98 const std::string& app_id, | 98 const std::string& app_id, |
99 const base::Callback<void(const base::FilePath&)>& callback) { | 99 const base::Callback<void(const base::FilePath&)>& callback) { |
100 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
101 ExtensionService* service = profile_->GetExtensionService(); | 101 ExtensionService* service = profile_->GetExtensionService(); |
102 DCHECK(service); | 102 DCHECK(service); |
103 const extensions::Extension* extension = | 103 const extensions::Extension* extension = |
104 service->GetInstalledExtension(app_id); | 104 service->GetInstalledExtension(app_id); |
105 DCHECK(extension); | 105 if (!extension) { |
| 106 callback.Run(base::FilePath()); |
| 107 return; |
| 108 } |
106 | 109 |
107 base::FilePath app_data_dir( | 110 base::FilePath app_data_dir( |
108 web_app::GetWebAppDataDirectory(profile_->GetPath(), | 111 web_app::GetWebAppDataDirectory(profile_->GetPath(), |
109 extension->id(), | 112 extension->id(), |
110 GURL())); | 113 GURL())); |
111 | 114 |
112 web_app::UpdateShortcutInfoAndIconForApp( | 115 web_app::UpdateShortcutInfoAndIconForApp( |
113 *extension, | 116 *extension, |
114 profile_, | 117 profile_, |
115 base::Bind(CreateShortcutInWebAppDir, app_data_dir, callback)); | 118 base::Bind(CreateShortcutInWebAppDir, app_data_dir, callback)); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 202 } |
200 | 203 |
201 void AppListViewDelegate::OpenFeedback() { | 204 void AppListViewDelegate::OpenFeedback() { |
202 chrome::HostDesktopType desktop = chrome::GetHostDesktopTypeForNativeWindow( | 205 chrome::HostDesktopType desktop = chrome::GetHostDesktopTypeForNativeWindow( |
203 controller_->GetAppListWindow()); | 206 controller_->GetAppListWindow()); |
204 Browser* browser = chrome::FindOrCreateTabbedBrowser( | 207 Browser* browser = chrome::FindOrCreateTabbedBrowser( |
205 profile_, desktop); | 208 profile_, desktop); |
206 chrome::ShowFeedbackPage(browser, std::string(), | 209 chrome::ShowFeedbackPage(browser, std::string(), |
207 chrome::kAppLauncherCategoryTag); | 210 chrome::kAppLauncherCategoryTag); |
208 } | 211 } |
OLD | NEW |