| 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/web_applications/web_app_win.h" | 5 #include "chrome/browser/web_applications/web_app_win.h" |
| 6 | 6 |
| 7 #include <shlobj.h> | 7 #include <shlobj.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 // a better way to achieve this. | 437 // a better way to achieve this. |
| 438 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, NULL, | 438 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, NULL, |
| 439 NULL); | 439 NULL); |
| 440 } | 440 } |
| 441 return true; | 441 return true; |
| 442 } | 442 } |
| 443 | 443 |
| 444 bool CreatePlatformShortcuts( | 444 bool CreatePlatformShortcuts( |
| 445 const base::FilePath& web_app_path, | 445 const base::FilePath& web_app_path, |
| 446 std::unique_ptr<ShortcutInfo> shortcut_info, | 446 std::unique_ptr<ShortcutInfo> shortcut_info, |
| 447 const extensions::FileHandlersInfo& file_handlers_info, | |
| 448 const ShortcutLocations& creation_locations, | 447 const ShortcutLocations& creation_locations, |
| 449 ShortcutCreationReason creation_reason) { | 448 ShortcutCreationReason creation_reason) { |
| 450 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); | 449 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); |
| 451 | 450 |
| 452 // Nothing to do on Windows for hidden apps. | 451 // Nothing to do on Windows for hidden apps. |
| 453 if (creation_locations.applications_menu_location == APP_MENU_LOCATION_HIDDEN) | 452 if (creation_locations.applications_menu_location == APP_MENU_LOCATION_HIDDEN) |
| 454 return true; | 453 return true; |
| 455 | 454 |
| 456 // Shortcut paths under which to create shortcuts. | 455 // Shortcut paths under which to create shortcuts. |
| 457 std::vector<base::FilePath> shortcut_paths = | 456 std::vector<base::FilePath> shortcut_paths = |
| (...skipping 22 matching lines...) Expand all Loading... |
| 480 // in the application name. | 479 // in the application name. |
| 481 base::FilePath shortcut_to_pin = web_app_path.Append(file_name). | 480 base::FilePath shortcut_to_pin = web_app_path.Append(file_name). |
| 482 AddExtension(installer::kLnkExt); | 481 AddExtension(installer::kLnkExt); |
| 483 if (!base::win::PinShortcutToTaskbar(shortcut_to_pin)) | 482 if (!base::win::PinShortcutToTaskbar(shortcut_to_pin)) |
| 484 return false; | 483 return false; |
| 485 } | 484 } |
| 486 | 485 |
| 487 return true; | 486 return true; |
| 488 } | 487 } |
| 489 | 488 |
| 490 void UpdatePlatformShortcuts( | 489 void UpdatePlatformShortcuts(const base::FilePath& web_app_path, |
| 491 const base::FilePath& web_app_path, | 490 const base::string16& old_app_title, |
| 492 const base::string16& old_app_title, | 491 std::unique_ptr<ShortcutInfo> shortcut_info) { |
| 493 std::unique_ptr<ShortcutInfo> shortcut_info, | |
| 494 const extensions::FileHandlersInfo& file_handlers_info) { | |
| 495 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); | 492 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); |
| 496 | 493 |
| 497 // Generates file name to use with persisted ico and shortcut file. | 494 // Generates file name to use with persisted ico and shortcut file. |
| 498 base::FilePath file_name = | 495 base::FilePath file_name = |
| 499 web_app::internals::GetSanitizedFileName(shortcut_info->title); | 496 web_app::internals::GetSanitizedFileName(shortcut_info->title); |
| 500 | 497 |
| 501 if (old_app_title != shortcut_info->title) { | 498 if (old_app_title != shortcut_info->title) { |
| 502 // The app's title has changed. Delete all existing app shortcuts and | 499 // The app's title has changed. Delete all existing app shortcuts and |
| 503 // recreate them in any locations they already existed (but do not add them | 500 // recreate them in any locations they already existed (but do not add them |
| 504 // to locations where they do not currently exist). | 501 // to locations where they do not currently exist). |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 617 |
| 621 } // namespace internals | 618 } // namespace internals |
| 622 | 619 |
| 623 void UpdateShortcutForTabContents(content::WebContents* web_contents) { | 620 void UpdateShortcutForTabContents(content::WebContents* web_contents) { |
| 624 // UpdateShortcutWorker will delete itself when it's done. | 621 // UpdateShortcutWorker will delete itself when it's done. |
| 625 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); | 622 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); |
| 626 worker->Run(); | 623 worker->Run(); |
| 627 } | 624 } |
| 628 | 625 |
| 629 } // namespace web_app | 626 } // namespace web_app |
| OLD | NEW |