OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/web_applications/web_app_ui.h" | 5 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 void UpdateShortcutWorker::UpdateShortcuts() { | 222 void UpdateShortcutWorker::UpdateShortcuts() { |
223 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 223 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
224 base::Bind(&UpdateShortcutWorker::UpdateShortcutsOnFileThread, | 224 base::Bind(&UpdateShortcutWorker::UpdateShortcutsOnFileThread, |
225 base::Unretained(this))); | 225 base::Unretained(this))); |
226 } | 226 } |
227 | 227 |
228 void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { | 228 void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { |
229 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 229 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
230 | 230 |
231 FilePath web_app_path = web_app::internals::GetWebAppDataDirectory( | 231 FilePath web_app_path = web_app::GetWebAppDataDirectory( |
232 web_app::GetDataDir(profile_path_), shortcut_info_); | 232 profile_path_, shortcut_info_.extension_id, shortcut_info_.url); |
233 | 233 |
234 // Ensure web_app_path exists. web_app_path could be missing for a legacy | 234 // Ensure web_app_path exists. web_app_path could be missing for a legacy |
235 // shortcut created by Gears. | 235 // shortcut created by Gears. |
236 if (!file_util::PathExists(web_app_path) && | 236 if (!file_util::PathExists(web_app_path) && |
237 !file_util::CreateDirectory(web_app_path)) { | 237 !file_util::CreateDirectory(web_app_path)) { |
238 NOTREACHED(); | 238 NOTREACHED(); |
239 return; | 239 return; |
240 } | 240 } |
241 | 241 |
242 FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( | 242 FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 void UpdateShortcutForTabContents(TabContentsWrapper* tab_contents) { | 315 void UpdateShortcutForTabContents(TabContentsWrapper* tab_contents) { |
316 #if defined(OS_WIN) | 316 #if defined(OS_WIN) |
317 // UpdateShortcutWorker will delete itself when it's done. | 317 // UpdateShortcutWorker will delete itself when it's done. |
318 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); | 318 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); |
319 worker->Run(); | 319 worker->Run(); |
320 #endif // defined(OS_WIN) | 320 #endif // defined(OS_WIN) |
321 } | 321 } |
322 | 322 |
323 } // namespace web_app | 323 } // namespace web_app |
OLD | NEW |