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

Unified Diff: chrome/installer/util/shell_util.h

Issue 487693002: ShellUtil: Add generic methods to add/delete Windows file associations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/shell_util.h
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index bf0f2181a6b2b067403343d8b9272e7911edbbe6..a428ffbd04e37b19dc12c688dd8d6adc91dcc5e0 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -26,6 +26,7 @@ class BrowserDistribution;
namespace base {
class CancellationFlag;
+class CommandLine;
}
// This is a utility class that provides common shell integration methods
@@ -600,6 +601,35 @@ class ShellUtil {
// bytes.
static base::string16 ByteArrayToBase32(const uint8* bytes, size_t size);
+ // 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.
gab 2014/09/12 13:32:37 Did you try this on Win8? Typically nothing become
+ // 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
+ // 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.
+ static bool AddFileAssociations(
+ const base::string16& progid,
+ const base::CommandLine& command_line,
+ const base::string16& file_type_name,
+ const base::FilePath& icon_path,
+ const std::set<base::string16>& 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.
+ static bool DeleteFileAssociations(const base::string16& progid);
+
private:
DISALLOW_COPY_AND_ASSIGN(ShellUtil);
};

Powered by Google App Engine
This is Rietveld 408576698