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

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

Issue 311293002: Ensure ephemeral apps have dock icons on mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use new enum instead of hidden Created 6 years, 6 months 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
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 "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool shortcut_visible =
604 creation_locations.applications_menu_location != APP_MENU_LOCATION_HIDDEN;
605 if (shortcut_visible)
606 paths.push_back(applications_dir);
607
608 DCHECK(!paths.empty());
604 size_t success_count = CreateShortcutsIn(paths); 609 size_t success_count = CreateShortcutsIn(paths);
605 if (success_count == 0) 610 if (success_count == 0)
606 return false; 611 return false;
607 612
608 if (!is_app_list) 613 if (!is_app_list)
609 UpdateInternalBundleIdentifier(); 614 UpdateInternalBundleIdentifier();
610 615
611 if (success_count != paths.size()) 616 if (success_count != paths.size())
612 return false; 617 return false;
613 618
614 if (creation_locations.in_quick_launch_bar && path_to_add_to_dock) { 619 if (creation_locations.in_quick_launch_bar && path_to_add_to_dock &&
620 shortcut_visible) {
615 switch (dock::AddIcon(path_to_add_to_dock, nil)) { 621 switch (dock::AddIcon(path_to_add_to_dock, nil)) {
616 case dock::IconAddFailure: 622 case dock::IconAddFailure:
617 // If adding the icon failed, instead reveal the Finder window. 623 // If adding the icon failed, instead reveal the Finder window.
618 RevealAppShimInFinder(); 624 RevealAppShimInFinder();
619 break; 625 break;
620 case dock::IconAddSuccess: 626 case dock::IconAddSuccess:
621 case dock::IconAlreadyPresent: 627 case dock::IconAlreadyPresent:
622 break; 628 break;
623 } 629 }
624 return true; 630 return true;
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 web_app::UpdateShortcutInfoAndIconForApp( 1013 web_app::UpdateShortcutInfoAndIconForApp(
1008 app, 1014 app,
1009 profile, 1015 profile,
1010 base::Bind(&web_app::CreateAppShortcutInfoLoaded, 1016 base::Bind(&web_app::CreateAppShortcutInfoLoaded,
1011 profile, 1017 profile,
1012 app, 1018 app,
1013 close_callback)); 1019 close_callback));
1014 } 1020 }
1015 1021
1016 } // namespace chrome 1022 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app.cc ('k') | chrome/browser/web_applications/web_app_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698