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 "apps/app_shim/app_shim_mac.h" | 10 #include "apps/app_shim/app_shim_mac.h" |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 for (std::vector<base::FilePath>::const_iterator it = bundles.begin(); | 951 for (std::vector<base::FilePath>::const_iterator it = bundles.begin(); |
952 it != bundles.end(); ++it) { | 952 it != bundles.end(); ++it) { |
953 web_app::ShortcutInfo shortcut_info = | 953 web_app::ShortcutInfo shortcut_info = |
954 BuildShortcutInfoFromBundle(*it); | 954 BuildShortcutInfoFromBundle(*it); |
955 WebAppShortcutCreator shortcut_creator( | 955 WebAppShortcutCreator shortcut_creator( |
956 it->DirName(), shortcut_info, extensions::FileHandlersInfo()); | 956 it->DirName(), shortcut_info, extensions::FileHandlersInfo()); |
957 shortcut_creator.DeleteShortcuts(); | 957 shortcut_creator.DeleteShortcuts(); |
958 } | 958 } |
959 } | 959 } |
960 | 960 |
| 961 void UpdateShortcutsForAllAppsForProfile(const base::FilePath& profile_path, |
| 962 const std::set<std::string>& app_ids) { |
| 963 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 964 web_app::ShortcutLocations creation_locations; |
| 965 // Create the shortcut in the Chrome Apps subdir. |
| 966 creation_locations.applications_menu_location = |
| 967 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; |
| 968 |
| 969 for (std::set<std::string>::const_iterator it = app_ids.begin(); |
| 970 it != app_ids.end(); |
| 971 ++it) { |
| 972 BrowserThread::PostTask( |
| 973 BrowserThread::UI, |
| 974 FROM_HERE, |
| 975 base::Bind(&web_app::internals::CallForProfileAndAppId, |
| 976 profile_path, |
| 977 *it, |
| 978 base::Bind(&web_app::CreateShortcuts, |
| 979 web_app::SHORTCUT_CREATION_AUTOMATED, |
| 980 creation_locations))); |
| 981 } |
| 982 } |
| 983 |
961 } // namespace internals | 984 } // namespace internals |
962 | 985 |
963 } // namespace web_app | 986 } // namespace web_app |
964 | 987 |
965 namespace chrome { | 988 namespace chrome { |
966 | 989 |
967 void ShowCreateChromeAppShortcutsDialog( | 990 void ShowCreateChromeAppShortcutsDialog( |
968 gfx::NativeWindow /*parent_window*/, | 991 gfx::NativeWindow /*parent_window*/, |
969 Profile* profile, | 992 Profile* profile, |
970 const extensions::Extension* app, | 993 const extensions::Extension* app, |
971 const base::Callback<void(bool)>& close_callback) { | 994 const base::Callback<void(bool)>& close_callback) { |
972 web_app::UpdateShortcutInfoAndIconForApp( | 995 web_app::UpdateShortcutInfoAndIconForApp( |
973 app, | 996 app, |
974 profile, | 997 profile, |
975 base::Bind(&web_app::CreateAppShortcutInfoLoaded, | 998 base::Bind(&web_app::CreateAppShortcutInfoLoaded, |
976 profile, | 999 profile, |
977 app, | 1000 app, |
978 close_callback)); | 1001 close_callback)); |
979 } | 1002 } |
980 | 1003 |
981 } // namespace chrome | 1004 } // namespace chrome |
OLD | NEW |