OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #endif // defined(OS_WIN) | 9 #endif // defined(OS_WIN) |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
(...skipping 14 matching lines...) Expand all Loading... |
26 #include "chrome/browser/tab_contents/tab_contents.h" | 26 #include "chrome/browser/tab_contents/tab_contents.h" |
27 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
28 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
29 #include "chrome/common/chrome_plugin_util.h" | 29 #include "chrome/common/chrome_plugin_util.h" |
30 #include "chrome/common/notification_registrar.h" | 30 #include "chrome/common/notification_registrar.h" |
31 #include "chrome/common/notification_service.h" | 31 #include "chrome/common/notification_service.h" |
32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
33 #include "webkit/glue/dom_operations.h" | 33 #include "webkit/glue/dom_operations.h" |
34 | 34 |
35 #if defined(OS_LINUX) | 35 #if defined(OS_LINUX) |
36 #include "base/linux_util.h" | 36 #include "base/env_var.h" |
37 #endif // defined(OS_LINUX) | 37 #endif // defined(OS_LINUX) |
38 | 38 |
39 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
40 #include "base/win_util.h" | 40 #include "base/win_util.h" |
41 #include "gfx/icon_util.h" | 41 #include "gfx/icon_util.h" |
42 #endif // defined(OS_WIN) | 42 #endif // defined(OS_WIN) |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 const FilePath::CharType kIconChecksumFileExt[] = FILE_PATH_LITERAL(".ico.md5"); | 46 const FilePath::CharType kIconChecksumFileExt[] = FILE_PATH_LITERAL(".ico.md5"); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 if (callback_ != NULL) | 255 if (callback_ != NULL) |
256 message_loop_->PostTask(FROM_HERE, | 256 message_loop_->PostTask(FROM_HERE, |
257 new CreateShortcutCallbackTask(callback_, success)); | 257 new CreateShortcutCallbackTask(callback_, success)); |
258 } | 258 } |
259 | 259 |
260 bool CreateShortcutTask::CreateShortcut() { | 260 bool CreateShortcutTask::CreateShortcut() { |
261 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); | 261 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); |
262 | 262 |
263 #if defined(OS_LINUX) | 263 #if defined(OS_LINUX) |
264 scoped_ptr<base::EnvironmentVariableGetter> env_getter( | 264 scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); |
265 base::EnvironmentVariableGetter::Create()); | |
266 | 265 |
267 std::string shortcut_template; | 266 std::string shortcut_template; |
268 if (!ShellIntegration::GetDesktopShortcutTemplate(env_getter.get(), | 267 if (!ShellIntegration::GetDesktopShortcutTemplate(env_getter.get(), |
269 &shortcut_template)) { | 268 &shortcut_template)) { |
270 return false; | 269 return false; |
271 } | 270 } |
272 ShellIntegration::CreateDesktopShortcut(shortcut_info_, shortcut_template); | 271 ShellIntegration::CreateDesktopShortcut(shortcut_info_, shortcut_template); |
273 return true; // assuming always success. | 272 return true; // assuming always success. |
274 #elif defined(OS_WIN) | 273 #elif defined(OS_WIN) |
275 // Shortcut paths under which to create shortcuts. | 274 // Shortcut paths under which to create shortcuts. |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 | 757 |
759 void UpdateShortcutForTabContents(TabContents* tab_contents) { | 758 void UpdateShortcutForTabContents(TabContents* tab_contents) { |
760 #if defined(OS_WIN) | 759 #if defined(OS_WIN) |
761 // UpdateShortcutWorker will delete itself when it's done. | 760 // UpdateShortcutWorker will delete itself when it's done. |
762 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); | 761 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); |
763 worker->Run(); | 762 worker->Run(); |
764 #endif // defined(OS_WIN) | 763 #endif // defined(OS_WIN) |
765 } | 764 } |
766 | 765 |
767 }; // namespace web_app | 766 }; // namespace web_app |
OLD | NEW |