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

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: Minor comment change. 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
« no previous file with comments | « no previous file | chrome/installer/util/shell_util.cc » ('j') | chrome/installer/util/shell_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..313972a92de2819204690301c888789455290449 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -12,6 +12,7 @@
#include <windows.h>
#include <map>
+#include <set>
#include <utility>
#include <vector>
@@ -26,6 +27,7 @@ class BrowserDistribution;
namespace base {
class CancellationFlag;
+class CommandLine;
}
// This is a utility class that provides common shell integration methods
@@ -600,6 +602,38 @@ 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.
+ // Otherwise, the application is added to the Open With menu for this type,
+ // but does not become the default.
+ //
+ // |prog_id| is the ProgId used by Windows for file associations with this
+ // application. Must not be empty or start with a '.'.
+ // |command_line| is the command to execute when opening a file via this
+ // association. It should contain "%1" (to tell Windows 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.)
+ // |file_extensions| is the set of extensions to associate. They must not be
+ // empty or start with a '.'.
+ // Returns true on success, false on failure.
+ static bool AddFileAssociations(
+ const base::string16& prog_id,
+ 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.
+ // |prog_id| is the ProgId used by Windows for file associations with this
+ // application, as given to AddFileAssociations. All information associated
+ // with this name will be deleted.
+ static bool DeleteFileAssociations(const base::string16& prog_id);
+
private:
DISALLOW_COPY_AND_ASSIGN(ShellUtil);
};
« no previous file with comments | « no previous file | chrome/installer/util/shell_util.cc » ('j') | chrome/installer/util/shell_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698