| 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 #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 "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 // placed under the profile path. For shims, this copy is used when the | 592 // placed under the profile path. For shims, this copy is used when the |
| 593 // version under Applications is removed, and not needed for app list because | 593 // version under Applications is removed, and not needed for app list because |
| 594 // setting LSUIElement means there is no Dock "running" status to show. | 594 // setting LSUIElement means there is no Dock "running" status to show. |
| 595 const bool is_app_list = info_.extension_id == app_mode::kAppListModeId; | 595 const bool is_app_list = info_.extension_id == app_mode::kAppListModeId; |
| 596 if (is_app_list) { | 596 if (is_app_list) { |
| 597 path_to_add_to_dock = base::SysUTF8ToNSString( | 597 path_to_add_to_dock = base::SysUTF8ToNSString( |
| 598 applications_dir.Append(GetShortcutBasename()).AsUTF8Unsafe()); | 598 applications_dir.Append(GetShortcutBasename()).AsUTF8Unsafe()); |
| 599 } else { | 599 } else { |
| 600 paths.push_back(app_data_dir_); | 600 paths.push_back(app_data_dir_); |
| 601 } | 601 } |
| 602 paths.push_back(applications_dir); | |
| 603 | 602 |
| 603 if (!creation_locations.hidden) |
| 604 paths.push_back(applications_dir); |
| 605 |
| 606 DCHECK(!paths.empty()); |
| 604 size_t success_count = CreateShortcutsIn(paths); | 607 size_t success_count = CreateShortcutsIn(paths); |
| 605 if (success_count == 0) | 608 if (success_count == 0) |
| 606 return false; | 609 return false; |
| 607 | 610 |
| 608 if (!is_app_list) | 611 if (!is_app_list) |
| 609 UpdateInternalBundleIdentifier(); | 612 UpdateInternalBundleIdentifier(); |
| 610 | 613 |
| 611 if (success_count != paths.size()) | 614 if (success_count != paths.size()) |
| 612 return false; | 615 return false; |
| 613 | 616 |
| 614 if (creation_locations.in_quick_launch_bar && path_to_add_to_dock) { | 617 if (creation_locations.in_quick_launch_bar && path_to_add_to_dock && |
| 618 !creation_locations.hidden) { |
| 615 switch (dock::AddIcon(path_to_add_to_dock, nil)) { | 619 switch (dock::AddIcon(path_to_add_to_dock, nil)) { |
| 616 case dock::IconAddFailure: | 620 case dock::IconAddFailure: |
| 617 // If adding the icon failed, instead reveal the Finder window. | 621 // If adding the icon failed, instead reveal the Finder window. |
| 618 RevealAppShimInFinder(); | 622 RevealAppShimInFinder(); |
| 619 break; | 623 break; |
| 620 case dock::IconAddSuccess: | 624 case dock::IconAddSuccess: |
| 621 case dock::IconAlreadyPresent: | 625 case dock::IconAlreadyPresent: |
| 622 break; | 626 break; |
| 623 } | 627 } |
| 624 return true; | 628 return true; |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 web_app::UpdateShortcutInfoAndIconForApp( | 1011 web_app::UpdateShortcutInfoAndIconForApp( |
| 1008 app, | 1012 app, |
| 1009 profile, | 1013 profile, |
| 1010 base::Bind(&web_app::CreateAppShortcutInfoLoaded, | 1014 base::Bind(&web_app::CreateAppShortcutInfoLoaded, |
| 1011 profile, | 1015 profile, |
| 1012 app, | 1016 app, |
| 1013 close_callback)); | 1017 close_callback)); |
| 1014 } | 1018 } |
| 1015 | 1019 |
| 1016 } // namespace chrome | 1020 } // namespace chrome |
| OLD | NEW |