diff options
author | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-01 07:48:53 +0000 |
---|---|---|
committer | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-01 07:48:53 +0000 |
commit | b5ff7ab385273571a809832c52939e98e97455fa (patch) | |
tree | a04b83adbf90c19fb03bf0205955f3d4b8116e40 /chrome | |
parent | ea315d056841c6ea0f30f17b2e61ce930c1c5ccd (diff) | |
download | chromium_src-b5ff7ab385273571a809832c52939e98e97455fa.zip chromium_src-b5ff7ab385273571a809832c52939e98e97455fa.tar.gz chromium_src-b5ff7ab385273571a809832c52939e98e97455fa.tar.bz2 |
Split the location flags from ShortcutInfo into a new struct ShortcutLocations.
The majority of code using ShortcutInfo ignores these flags, making it hard to
reason about exactly when they will be respected. Now ShortcutLocations is
explicitly passed in all the places where it is required (relatively few).
Generally, shortcut creation makes use of these flags, whereas shortcut update
and deletion does not.
In a few places (web_app_ui: ShortcutInfoForExtensionAndProfile,
web_app_ui: CheckExistingShortcuts) these booleans were being assigned to, but
never read back. Deleted those assignments.
BUG=178964
Review URL: https://chromiumcodereview.appspot.com/12382011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/shell_integration.cc | 11 | ||||
-rw-r--r-- | chrome/browser/shell_integration.h | 11 | ||||
-rw-r--r-- | chrome/browser/shell_integration_linux.cc | 9 | ||||
-rw-r--r-- | chrome/browser/shell_integration_linux.h | 6 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_cocoa.mm | 8 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc | 17 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/create_application_shortcut_view.cc | 11 | ||||
-rw-r--r-- | chrome/browser/ui/web_applications/web_app_ui.cc | 10 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app.cc | 12 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app.h | 19 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_android.cc | 3 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_linux.cc | 5 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_mac.mm | 3 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_win.cc | 37 |
15 files changed, 98 insertions, 70 deletions
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc index cd299c5..ec5d601 100644 --- a/chrome/browser/shell_integration.cc +++ b/chrome/browser/shell_integration.cc @@ -27,14 +27,17 @@ ShellIntegration::DefaultWebClientSetPermission } ShellIntegration::ShortcutInfo::ShortcutInfo() - : is_platform_app(false), - create_on_desktop(false), - create_in_applications_menu(false), - create_in_quick_launch_bar(false) { + : is_platform_app(false) { } ShellIntegration::ShortcutInfo::~ShortcutInfo() {} +ShellIntegration::ShortcutLocations::ShortcutLocations() + : on_desktop(false), + in_applications_menu(false), + in_quick_launch_bar(false) { +} + static const struct ShellIntegration::AppModeInfo* gAppModeInfo = NULL; // static diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index a3e897c..2eac0df 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h @@ -103,15 +103,20 @@ class ShellIntegration { base::FilePath extension_path; gfx::Image favicon; base::FilePath profile_path; + }; + + // Info about which locations to create app shortcuts in. + struct ShortcutLocations { + ShortcutLocations(); - bool create_on_desktop; - bool create_in_applications_menu; + bool on_desktop; + bool in_applications_menu; // For Windows, this refers to quick launch bar prior to Win7. In Win7, // this means "pin to taskbar". For Mac/Linux, this could be used for // Mac dock or the gnome/kde application launcher. However, those are not // implemented yet. - bool create_in_quick_launch_bar; + bool in_quick_launch_bar; }; // Data that needs to be passed between the app launcher stub and Chrome. diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index a97a072..e7412ae 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -673,6 +673,7 @@ std::string GetDesktopFileContents( bool CreateDesktopShortcut( const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations, const std::string& shortcut_template) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); @@ -682,9 +683,9 @@ bool CreateDesktopShortcut( shortcut_info.profile_path, shortcut_info.extension_id); // For extensions we do not want duplicate shortcuts. So, delete any that // already exist and replace them. - if (shortcut_info.create_on_desktop) + if (creation_locations.on_desktop) DeleteShortcutOnDesktop(shortcut_filename); - if (shortcut_info.create_in_applications_menu) + if (creation_locations.in_applications_menu) DeleteShortcutInApplicationsMenu(shortcut_filename); } else { shortcut_filename = GetWebShortcutFilename(shortcut_info.url); @@ -708,10 +709,10 @@ bool CreateDesktopShortcut( bool success = true; - if (shortcut_info.create_on_desktop) + if (creation_locations.on_desktop) success = CreateShortcutOnDesktop(shortcut_filename, contents); - if (shortcut_info.create_in_applications_menu) + if (creation_locations.in_applications_menu) success = CreateShortcutInApplicationsMenu(shortcut_filename, contents) && success; diff --git a/chrome/browser/shell_integration_linux.h b/chrome/browser/shell_integration_linux.h index 519895c..e3f36ef 100644 --- a/chrome/browser/shell_integration_linux.h +++ b/chrome/browser/shell_integration_linux.h @@ -50,8 +50,10 @@ std::string GetDesktopFileContents(const std::string& template_contents, // shortcut template contained in |shortcut_template|. // For extensions, duplicate shortcuts are avoided, so if a requested shortcut // already exists it is deleted first. -bool CreateDesktopShortcut(const ShellIntegration::ShortcutInfo& shortcut_info, - const std::string& shortcut_template); +bool CreateDesktopShortcut( + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations, + const std::string& shortcut_template); // Delete any desktop shortcuts on desktop or in the application menu that have // been added for the extension with |extension_id| in |profile_path|. diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index ba96f4c..4b85714 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -103,6 +103,12 @@ NSPoint GetPointForBubble(content::WebContents* web_contents, return point; } +void CreateShortcuts(const ShellIntegration::ShortcutInfo& shortcut_info) { + // creation_locations will be ignored by CreatePlatformShortcuts on Mac. + ShellIntegration::ShortcutLocations creation_locations; + web_app::CreateShortcuts(shortcut_info, creation_locations); +} + } // namespace BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, @@ -582,7 +588,7 @@ void BrowserWindowCocoa::ShowCreateChromeAppShortcutsDialog( // Normally we would show a dialog, but since we always create the app // shortcut in /Applications there are no options for the user to choose. web_app::UpdateShortcutInfoAndIconForApp(*app, profile, - base::Bind(&web_app::CreateShortcuts)); + base::Bind(&CreateShortcuts)); } void BrowserWindowCocoa::Cut() { diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc index f4ead6a..3fd2dbd 100644 --- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc @@ -234,14 +234,14 @@ void CreateApplicationShortcutsDialogGtk::OnCreateDialogResponse( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (response == GTK_RESPONSE_ACCEPT) { - shortcut_info_.create_on_desktop = + ShellIntegration::ShortcutLocations creation_locations; + creation_locations.on_desktop = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(desktop_checkbox_)); - shortcut_info_.create_in_applications_menu = + creation_locations.in_applications_menu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(menu_checkbox_)); BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut, - this, - shortcut_info_)); + this, shortcut_info_, creation_locations)); OnCreatedShortcut(); } else { @@ -255,7 +255,8 @@ void CreateApplicationShortcutsDialogGtk::OnErrorDialogResponse( } void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( - const ShellIntegration::ShortcutInfo& shortcut_info) { + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); scoped_ptr<base::Environment> env(base::Environment::Create()); @@ -264,6 +265,7 @@ void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( if (ShellIntegrationLinux::GetDesktopShortcutTemplate(env.get(), &shortcut_template)) { ShellIntegrationLinux::CreateDesktopShortcut(shortcut_info, + creation_locations, shortcut_template); Release(); } else { @@ -370,10 +372,11 @@ void CreateChromeApplicationShortcutsDialogGtk::OnShortcutInfoLoaded( } void CreateChromeApplicationShortcutsDialogGtk::CreateDesktopShortcut( - const ShellIntegration::ShortcutInfo& shortcut_info) { + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - if (web_app::CreateShortcutsOnFileThread(shortcut_info)) { + if (web_app::CreateShortcutsOnFileThread(shortcut_info, creation_locations)) { Release(); } else { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h index 79adee7..3d5c3b6 100644 --- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h +++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h @@ -58,7 +58,8 @@ class CreateApplicationShortcutsDialogGtk virtual void OnCreatedShortcut(void) {} virtual void CreateDesktopShortcut( - const ShellIntegration::ShortcutInfo& shortcut_info); + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations); virtual void ShowErrorDialog(); GtkWindow* parent_; @@ -123,7 +124,8 @@ class CreateChromeApplicationShortcutsDialogGtk virtual ~CreateChromeApplicationShortcutsDialogGtk() {} virtual void CreateDesktopShortcut( - const ShellIntegration::ShortcutInfo& shortcut_info) OVERRIDE; + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations) OVERRIDE; private: void OnShortcutInfoLoaded( diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index 8df26bb..1d27d3a 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -405,20 +405,21 @@ bool CreateApplicationShortcutView::Accept() { if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)) return false; - shortcut_info_.create_on_desktop = desktop_check_box_->checked(); - shortcut_info_.create_in_applications_menu = menu_check_box_ == NULL ? false : + ShellIntegration::ShortcutLocations creation_locations; + creation_locations.on_desktop = desktop_check_box_->checked(); + creation_locations.in_applications_menu = menu_check_box_ == NULL ? false : menu_check_box_->checked(); #if defined(OS_WIN) - shortcut_info_.create_in_quick_launch_bar = quick_launch_check_box_ == NULL ? + creation_locations.in_quick_launch_bar = quick_launch_check_box_ == NULL ? NULL : quick_launch_check_box_->checked(); #elif defined(OS_POSIX) // Create shortcut in Mac dock or as Linux (gnome/kde) application launcher // are not implemented yet. - shortcut_info_.create_in_quick_launch_bar = false; + creation_locations.in_quick_launch_bar = false; #endif - web_app::CreateShortcuts(shortcut_info_); + web_app::CreateShortcuts(shortcut_info_, creation_locations); return true; } diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc index 99c6652..34ad3d0 100644 --- a/chrome/browser/ui/web_applications/web_app_ui.cc +++ b/chrome/browser/ui/web_applications/web_app_ui.cc @@ -211,20 +211,16 @@ void UpdateShortcutWorker::CheckExistingShortcuts() { // Locations to check to shortcut_paths. struct { - bool& use_this_location; int location_id; const wchar_t* sub_dir; } locations[] = { { - shortcut_info_.create_on_desktop, base::DIR_USER_DESKTOP, NULL }, { - shortcut_info_.create_in_applications_menu, base::DIR_START_MENU, NULL }, { - shortcut_info_.create_in_quick_launch_bar, // For Win7, create_in_quick_launch_bar means pinning to taskbar. base::DIR_APP_DATA, (base::win::GetVersion() >= base::win::VERSION_WIN7) ? @@ -234,8 +230,6 @@ void UpdateShortcutWorker::CheckExistingShortcuts() { }; for (int i = 0; i < arraysize(locations); ++i) { - locations[i].use_this_location = false; - base::FilePath path; if (!PathService::Get(locations[i].location_id, &path)) { NOTREACHED(); @@ -248,7 +242,6 @@ void UpdateShortcutWorker::CheckExistingShortcuts() { base::FilePath shortcut_file = path.Append(file_name_). ReplaceExtension(FILE_PATH_LITERAL(".lnk")); if (file_util::PathExists(shortcut_file)) { - locations[i].use_this_location = true; shortcut_files_.push_back(shortcut_file); } } @@ -354,9 +347,6 @@ ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( const extensions::Extension* extension, Profile* profile) { ShellIntegration::ShortcutInfo shortcut_info; web_app::UpdateShortcutInfoForApp(*extension, profile, &shortcut_info); - shortcut_info.create_in_applications_menu = true; - shortcut_info.create_in_quick_launch_bar = true; - shortcut_info.create_on_desktop = true; return shortcut_info; } diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 4af6705..d0b01a2 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -140,14 +140,16 @@ std::string GetExtensionIdFromApplicationName(const std::string& app_name) { return app_name.substr(prefix.length()); } -void CreateShortcuts(const ShellIntegration::ShortcutInfo& shortcut_info) { +void CreateShortcuts( + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(base::IgnoreResult(&CreateShortcutsOnFileThread), - shortcut_info)); + shortcut_info, creation_locations)); } void DeleteAllShortcuts(const ShellIntegration::ShortcutInfo& shortcut_info) { @@ -169,13 +171,15 @@ void UpdateAllShortcuts(const ShellIntegration::ShortcutInfo& shortcut_info) { } bool CreateShortcutsOnFileThread( - const ShellIntegration::ShortcutInfo& shortcut_info) { + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::FilePath shortcut_data_dir = GetWebAppDataDirectory( shortcut_info.profile_path, shortcut_info.extension_id, shortcut_info.url); - return internals::CreatePlatformShortcuts(shortcut_data_dir, shortcut_info); + return internals::CreatePlatformShortcuts(shortcut_data_dir, shortcut_info, + creation_locations); } bool IsValidUrl(const GURL& url) { diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index ced6064..ceacac2 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h @@ -47,8 +47,11 @@ std::string GenerateApplicationNameFromExtensionId(const std::string& id); std::string GetExtensionIdFromApplicationName(const std::string& app_name); // Creates shortcuts for web application based on given shortcut data. -// |shortcut_info| contains information about the shortcuts to create. -void CreateShortcuts(const ShellIntegration::ShortcutInfo& shortcut_info); +// |shortcut_info| contains information about the shortcuts to create, and +// |creation_locations| contains information about where to create them. +void CreateShortcuts( + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations); // Delete all the shortcuts that have been created for the given // |shortcut_data| in the profile with |profile_path|. @@ -60,9 +63,11 @@ void UpdateAllShortcuts(const ShellIntegration::ShortcutInfo& shortcut_info); // Creates a shortcut. Must be called on the file thread. This is used to // implement CreateShortcuts() above, and can also be used directly from the -// file thread. |shortcut_info| contains info about the shortcut to create. +// file thread. |shortcut_info| contains info about the shortcut to create, and +// |creation_locations| contains information about where to create them. bool CreateShortcutsOnFileThread( - const ShellIntegration::ShortcutInfo& shortcut_info); + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations); // Returns true if given url is a valid web app url. bool IsValidUrl(const GURL& url); @@ -92,10 +97,12 @@ bool CheckAndSaveIcon(const base::FilePath& icon_file, const SkBitmap& image); // shortcuts. Used internally by CreateShortcutsOnFileThread. // |shortcut_data_path| is where to store any resources created for the // shortcut, and is also used as the UserDataDir for platform app shortcuts. -// |shortcut_info| contains info about the shortcut to create. +// |shortcut_info| contains info about the shortcut to create, and +// |creation_locations| contains information about where to create them. bool CreatePlatformShortcuts( const base::FilePath& shortcut_data_path, - const ShellIntegration::ShortcutInfo& shortcut_info); + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations); // Delete all the shortcuts we have added for this extension. This is the // platform specific implementation of the DeleteAllShortcuts function, and diff --git a/chrome/browser/web_applications/web_app_android.cc b/chrome/browser/web_applications/web_app_android.cc index b6ff730..b8165f7 100644 --- a/chrome/browser/web_applications/web_app_android.cc +++ b/chrome/browser/web_applications/web_app_android.cc @@ -9,7 +9,8 @@ namespace internals { bool CreatePlatformShortcuts( const base::FilePath& web_app_path, - const ShellIntegration::ShortcutInfo& shortcut_info) { + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations) { return true; } diff --git a/chrome/browser/web_applications/web_app_linux.cc b/chrome/browser/web_applications/web_app_linux.cc index 325911f..0378b2a 100644 --- a/chrome/browser/web_applications/web_app_linux.cc +++ b/chrome/browser/web_applications/web_app_linux.cc @@ -15,7 +15,8 @@ namespace internals { bool CreatePlatformShortcuts( const base::FilePath& web_app_path, - const ShellIntegration::ShortcutInfo& shortcut_info) { + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); scoped_ptr<base::Environment> env(base::Environment::Create()); @@ -26,7 +27,7 @@ bool CreatePlatformShortcuts( return false; } return ShellIntegrationLinux::CreateDesktopShortcut( - shortcut_info, shortcut_template); + shortcut_info, creation_locations, shortcut_template); } void DeletePlatformShortcuts( diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index 5224191..2c61548 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -279,7 +279,8 @@ base::FilePath GetAppBundleByExtensionId(std::string extension_id) { bool CreatePlatformShortcuts( const base::FilePath& web_app_path, - const ShellIntegration::ShortcutInfo& shortcut_info) { + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& /*creation_locations*/) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID()); WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info, diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index 0fa8a04..399b086 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -74,26 +74,26 @@ bool ShouldUpdateIcon(const base::FilePath& icon_file, const SkBitmap& image) { } std::vector<base::FilePath> GetShortcutPaths( - ShellIntegration::ShortcutInfo shortcut_info) { + const ShellIntegration::ShortcutLocations& creation_locations) { // Shortcut paths under which to create shortcuts. std::vector<base::FilePath> shortcut_paths; // Locations to add to shortcut_paths. struct { - const bool& use_this_location; + bool use_this_location; int location_id; const wchar_t* sub_dir; } locations[] = { { - shortcut_info.create_on_desktop, + creation_locations.on_desktop, base::DIR_USER_DESKTOP, NULL }, { - shortcut_info.create_in_applications_menu, + creation_locations.in_applications_menu, base::DIR_START_MENU, NULL }, { - shortcut_info.create_in_quick_launch_bar, + creation_locations.in_quick_launch_bar, // For Win7, create_in_quick_launch_bar means pinning to taskbar. Use // base::PATH_START as a flag for this case. (base::win::GetVersion() >= base::win::VERSION_WIN7) ? @@ -202,13 +202,15 @@ base::FilePath GetShortcutExecutablePath( bool CreatePlatformShortcuts( const base::FilePath& web_app_path, - const ShellIntegration::ShortcutInfo& shortcut_info) { + const ShellIntegration::ShortcutInfo& shortcut_info, + const ShellIntegration::ShortcutLocations& creation_locations) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); // Shortcut paths under which to create shortcuts. - std::vector<base::FilePath> shortcut_paths = GetShortcutPaths(shortcut_info); + std::vector<base::FilePath> shortcut_paths = + GetShortcutPaths(creation_locations); - bool pin_to_taskbar = shortcut_info.create_in_quick_launch_bar && + bool pin_to_taskbar = creation_locations.in_quick_launch_bar && (base::win::GetVersion() >= base::win::VERSION_WIN7); // For Win7's pinning support, any shortcut could be used. So we only create @@ -334,18 +336,17 @@ void DeletePlatformShortcuts( DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); // Get all possible locations for shortcuts. - ShellIntegration::ShortcutInfo all_shortcuts_info = shortcut_info; - all_shortcuts_info.create_in_applications_menu = true; - all_shortcuts_info.create_in_quick_launch_bar = true; - all_shortcuts_info.create_on_desktop = true; - std::vector<base::FilePath> shortcut_locations = GetShortcutPaths( - all_shortcuts_info); + ShellIntegration::ShortcutLocations all_shortcut_locations; + all_shortcut_locations.in_applications_menu = true; + all_shortcut_locations.in_quick_launch_bar = true; + all_shortcut_locations.on_desktop = true; + std::vector<base::FilePath> shortcut_paths = GetShortcutPaths( + all_shortcut_locations); if (base::win::GetVersion() >= base::win::VERSION_WIN7) - shortcut_locations.push_back(web_app_path); + shortcut_paths.push_back(web_app_path); - for (std::vector<base::FilePath>::const_iterator i = - shortcut_locations.begin(); - i != shortcut_locations.end(); ++i) { + for (std::vector<base::FilePath>::const_iterator i = shortcut_paths.begin(); + i != shortcut_paths.end(); ++i) { std::vector<base::FilePath> shortcut_files = MatchingShortcutsForProfileAndExtension(*i, shortcut_info.profile_path, shortcut_info.title); |