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/web_applications/web_app.h" | 5 #include "chrome/browser/web_applications/web_app.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
19 #include "base/md5.h" | 19 #include "base/md5.h" |
20 #include "base/message_loop.h" | 20 #include "base/message_loop.h" |
21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
22 #include "base/scoped_ptr.h" | 22 #include "base/scoped_ptr.h" |
23 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
24 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
25 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
26 #include "chrome/browser/download/download_util.h" | 26 #include "chrome/browser/download/download_util.h" |
27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
29 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
30 #include "chrome/common/chrome_plugin_util.h" | |
31 #include "chrome/common/extensions/extension.h" | 30 #include "chrome/common/extensions/extension.h" |
32 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
33 #include "chrome/common/web_apps.h" | 32 #include "chrome/common/web_apps.h" |
34 #include "content/browser/browser_thread.h" | 33 #include "content/browser/browser_thread.h" |
35 #include "content/browser/tab_contents/tab_contents.h" | 34 #include "content/browser/tab_contents/tab_contents.h" |
36 #include "content/common/notification_registrar.h" | 35 #include "content/common/notification_registrar.h" |
37 | 36 |
38 #if defined(OS_LINUX) | 37 #if defined(OS_LINUX) |
39 #include "base/environment.h" | 38 #include "base/environment.h" |
40 #endif // defined(OS_LINUX) | 39 #endif // defined(OS_LINUX) |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 &UpdateShortcutWorker::UpdateShortcutsOnFileThread)); | 634 &UpdateShortcutWorker::UpdateShortcutsOnFileThread)); |
636 } | 635 } |
637 | 636 |
638 void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { | 637 void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { |
639 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 638 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
640 | 639 |
641 FilePath web_app_path = GetWebAppDataDirectory( | 640 FilePath web_app_path = GetWebAppDataDirectory( |
642 web_app::GetDataDir(profile_path_), shortcut_info_); | 641 web_app::GetDataDir(profile_path_), shortcut_info_); |
643 | 642 |
644 // Ensure web_app_path exists. web_app_path could be missing for a legacy | 643 // Ensure web_app_path exists. web_app_path could be missing for a legacy |
645 // shortcut created by gears. | 644 // shortcut created by Gears. |
646 if (!file_util::PathExists(web_app_path) && | 645 if (!file_util::PathExists(web_app_path) && |
647 !file_util::CreateDirectory(web_app_path)) { | 646 !file_util::CreateDirectory(web_app_path)) { |
648 NOTREACHED(); | 647 NOTREACHED(); |
649 return; | 648 return; |
650 } | 649 } |
651 | 650 |
652 FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( | 651 FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( |
653 FILE_PATH_LITERAL(".ico")); | 652 FILE_PATH_LITERAL(".ico")); |
654 CheckAndSaveIcon(icon_file, shortcut_info_.favicon); | 653 CheckAndSaveIcon(icon_file, shortcut_info_.favicon); |
655 | 654 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 794 |
796 void UpdateShortcutForTabContents(TabContents* tab_contents) { | 795 void UpdateShortcutForTabContents(TabContents* tab_contents) { |
797 #if defined(OS_WIN) | 796 #if defined(OS_WIN) |
798 // UpdateShortcutWorker will delete itself when it's done. | 797 // UpdateShortcutWorker will delete itself when it's done. |
799 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); | 798 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); |
800 worker->Run(); | 799 worker->Run(); |
801 #endif // defined(OS_WIN) | 800 #endif // defined(OS_WIN) |
802 } | 801 } |
803 | 802 |
804 }; // namespace web_app | 803 }; // namespace web_app |
OLD | NEW |