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

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

Issue 263403002: Replace OnceOffCreateShortcuts with UpdateShortcutsForAllAppsIfNeeded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check all extensions, not just enabled. 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 | Annotate | Revision Log
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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 for (std::vector<base::FilePath>::const_iterator it = bundles.begin(); 962 for (std::vector<base::FilePath>::const_iterator it = bundles.begin();
963 it != bundles.end(); ++it) { 963 it != bundles.end(); ++it) {
964 web_app::ShortcutInfo shortcut_info = 964 web_app::ShortcutInfo shortcut_info =
965 BuildShortcutInfoFromBundle(*it); 965 BuildShortcutInfoFromBundle(*it);
966 WebAppShortcutCreator shortcut_creator( 966 WebAppShortcutCreator shortcut_creator(
967 it->DirName(), shortcut_info, extensions::FileHandlersInfo()); 967 it->DirName(), shortcut_info, extensions::FileHandlersInfo());
968 shortcut_creator.DeleteShortcuts(); 968 shortcut_creator.DeleteShortcuts();
969 } 969 }
970 } 970 }
971 971
972 void UpdateShortcutsForAllAppsForProfile(const base::FilePath& profile_path,
973 const std::set<std::string>& app_ids) {
974 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
975 web_app::ShortcutLocations creation_locations;
976 // Create the shortcut in the Chrome Apps subdir.
977 creation_locations.applications_menu_location =
978 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
979
980 for (std::set<std::string>::const_iterator it = app_ids.begin();
981 it != app_ids.end();
982 ++it) {
983 content::BrowserThread::PostTask(
984 content::BrowserThread::UI,
tapted 2014/05/29 08:56:40 nit: indenting is off here
jackhou1 2014/05/30 04:38:53 Done.
985 FROM_HERE,
986 base::Bind(&web_app::internals::CallForProfileAndAppId,
987 profile_path,
988 *it,
989 base::Bind(&web_app::CreateShortcuts,
990 web_app::SHORTCUT_CREATION_AUTOMATED,
991 creation_locations)));
992 }
993 }
994
972 } // namespace internals 995 } // namespace internals
973 996
974 } // namespace web_app 997 } // namespace web_app
975 998
976 namespace chrome { 999 namespace chrome {
977 1000
978 void ShowCreateChromeAppShortcutsDialog( 1001 void ShowCreateChromeAppShortcutsDialog(
979 gfx::NativeWindow /*parent_window*/, 1002 gfx::NativeWindow /*parent_window*/,
980 Profile* profile, 1003 Profile* profile,
981 const extensions::Extension* app, 1004 const extensions::Extension* app,
982 const base::Callback<void(bool)>& close_callback) { 1005 const base::Callback<void(bool)>& close_callback) {
983 web_app::UpdateShortcutInfoAndIconForApp( 1006 web_app::UpdateShortcutInfoAndIconForApp(
984 app, 1007 app,
985 profile, 1008 profile,
986 base::Bind(&web_app::CreateAppShortcutInfoLoaded, 1009 base::Bind(&web_app::CreateAppShortcutInfoLoaded,
987 profile, 1010 profile,
988 app, 1011 app,
989 close_callback)); 1012 close_callback));
990 } 1013 }
991 1014
992 } // namespace chrome 1015 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698