Chromium Code Reviews| Index: chrome/browser/file_associations_win.h |
| diff --git a/chrome/browser/file_associations_win.h b/chrome/browser/file_associations_win.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4a362edce7da09a917f1a0d96e96a623ed801d6a |
| --- /dev/null |
| +++ b/chrome/browser/file_associations_win.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_FILE_ASSOCIATIONS_WIN_H_ |
| +#define CHROME_BROWSER_FILE_ASSOCIATIONS_WIN_H_ |
| + |
| +#include <set> |
| +#include <string> |
| + |
| +// This module is for manipulating per-user Windows file associations from an |
| +// unprivileged process (ie, Chrome itself). For the code that establishes the |
| +// machine-level associations during the Chrome installer, see |
| +// chrome/installer/util/shell_util.h. |
| + |
| +namespace base { |
| +class CommandLine; |
| +class FilePath; |
| +} |
| + |
| +// Associates a set of file extensions with a particular application in the |
| +// Windows registry, for the current user only. If an extension has no existing |
| +// default association, the given application becomes the default. Otherwise, |
| +// the application is added to the Open With menu for this type, but does not |
| +// become the default. |
| +// |
| +// |progid| is the unique internal name Windows will use for file associations |
|
jackhou1
2014/08/19 08:16:54
Is there a convention for how to specify a progid?
Matt Giuca
2014/08/19 08:24:48
Not really. Microsoft recommends "Vendor.Applicati
|
| +// with this application. |
| +// |command_line| is the command to execute when opening a file via this |
| +// association. It should contain "%1" to pass the filename as an argument. |
| +// |file_type_name| and |icon_path| are the friendly name, and the path of the |
| +// icon, respectively, that will be used for files of these types when |
| +// associated with this application by default. (They are NOT the name/icon that |
| +// will represent the application under the Open With menu.) |
| +// Returns true on success; otherwise logs to stderr and returns false. |
| +bool AddWindowsFileAssociations(const std::string& progid, |
| + const base::CommandLine& command_line, |
| + const std::string& file_type_name, |
| + const base::FilePath& icon_path, |
| + const std::set<std::string>& file_extensions); |
| + |
| +// Deletes all associations with a particular application in the Windows |
| +// registry, for the current user only. |
| +// |progid| is the unique internal name Windows uses for file associations with |
| +// this application, as given to AddWindowsFileAssociations. All information |
| +// associated with this name will be deleted. |
| +bool DeleteWindowsFileAssociations(const std::string& progid); |
| + |
| +#endif // CHROME_BROWSER_FILE_ASSOCIATIONS_WIN_H_ |