Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/browser/web_applications/web_app_mac.mm

Issue 42153002: Merge 230360 "[mac] Support adding the launcher to the Dock when..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1650/src/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/mac/dock.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import "chrome/browser/web_applications/web_app_mac.h" 5 #import "chrome/browser/web_applications/web_app_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "apps/app_shim/app_shim_mac.h" 10 #include "apps/app_shim/app_shim_mac.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 size_t success_count = CreateShortcutsIn(paths); 460 size_t success_count = CreateShortcutsIn(paths);
461 if (success_count == 0) 461 if (success_count == 0)
462 return false; 462 return false;
463 463
464 if (!is_app_list) 464 if (!is_app_list)
465 UpdateInternalBundleIdentifier(); 465 UpdateInternalBundleIdentifier();
466 466
467 if (success_count != paths.size()) 467 if (success_count != paths.size())
468 return false; 468 return false;
469 469
470 if (creation_locations.in_quick_launch_bar && path_to_add_to_dock) 470 if (creation_locations.in_quick_launch_bar && path_to_add_to_dock) {
471 dock::AddIcon(path_to_add_to_dock, nil); 471 switch (dock::AddIcon(path_to_add_to_dock, nil)) {
472 case dock::IconAddFailure:
473 // If adding the icon failed, instead reveal the Finder window.
474 RevealAppShimInFinder();
475 break;
476 case dock::IconAddSuccess:
477 case dock::IconAlreadyPresent:
478 break;
479 }
480 return true;
481 }
472 482
473 if (creation_reason == SHORTCUT_CREATION_BY_USER) 483 if (creation_reason == SHORTCUT_CREATION_BY_USER)
474 RevealAppShimInFinder(); 484 RevealAppShimInFinder();
475 485
476 return true; 486 return true;
477 } 487 }
478 488
479 void WebAppShortcutCreator::DeleteShortcuts() { 489 void WebAppShortcutCreator::DeleteShortcuts() {
480 base::FilePath app_path = GetApplicationsShortcutPath(); 490 base::FilePath app_path = GetApplicationsShortcutPath();
481 if (!app_path.empty() && HasSameUserDataDir(app_path)) 491 if (!app_path.empty() && HasSameUserDataDir(app_path))
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 ShellIntegration::ShortcutInfo shortcut_info = 755 ShellIntegration::ShortcutInfo shortcut_info =
746 BuildShortcutInfoFromBundle(*it); 756 BuildShortcutInfoFromBundle(*it);
747 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info); 757 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info);
748 shortcut_creator.DeleteShortcuts(); 758 shortcut_creator.DeleteShortcuts();
749 } 759 }
750 } 760 }
751 761
752 } // namespace internals 762 } // namespace internals
753 763
754 } // namespace web_app 764 } // namespace web_app
OLDNEW
« no previous file with comments | « chrome/browser/mac/dock.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698