summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_init.cc19
-rw-r--r--chrome/browser/download/download_manager.cc8
-rw-r--r--chrome/browser/profile.cc3
-rw-r--r--chrome/common/chrome_constants.cc1
-rw-r--r--chrome/common/chrome_constants.h1
-rw-r--r--chrome/installer/util/shell_util.cc29
-rw-r--r--chrome/installer/util/shell_util.h11
7 files changed, 60 insertions, 12 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index 2e94348..bf9f69bf 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -222,15 +222,6 @@ bool BrowserInit::LaunchWithProfile::Launch(Profile* profile,
}
}
- // Start up the extensions service
- profile->InitExtensions();
- if (parsed_command_line.HasSwitch(switches::kInstallExtension)) {
- std::wstring path_string =
- parsed_command_line.GetSwitchValue(switches::kInstallExtension);
- FilePath path = FilePath::FromWStringHack(path_string);
- profile->GetExtensionsService()->InstallExtension(path);
- }
-
return true;
}
@@ -393,9 +384,17 @@ bool BrowserInit::ProcessCommandLine(const CommandLine& parsed_command_line,
profile, expected_tabs);
}
- // Start up the extensions service.
+ // Start up the extensions service
profile->InitExtensions();
+ if (parsed_command_line.HasSwitch(switches::kInstallExtension)) {
+ std::wstring path_string =
+ parsed_command_line.GetSwitchValue(switches::kInstallExtension);
+ FilePath path = FilePath::FromWStringHack(path_string);
+ profile->GetExtensionsService()->InstallExtension(path);
+ silent_launch = true;
+ }
+
// If we don't want to launch a new browser window or tab (in the case
// of an automation request), we are done here.
if (!silent_launch) {
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 9ac3099..44038b4 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -19,12 +19,14 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_file.h"
#include "chrome/browser/download/download_util.h"
+#include "chrome/browser/extensions/extension.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/tab_contents/web_contents.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/notification_service.h"
@@ -1167,9 +1169,11 @@ void DownloadManager::OpenFilesOfExtension(
bool DownloadManager::ShouldOpenFileExtension(
const FilePath::StringType& extension) {
+ // Special-case Chrome extensions as always-open.
if (!IsExecutable(extension) &&
- auto_open_.find(extension) != auto_open_.end())
- return true;
+ (auto_open_.find(extension) != auto_open_.end() ||
+ extension == chrome::kExtensionFileExtension))
+ return true;
return false;
}
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index b4fd605..5e1bbd3 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -341,6 +341,9 @@ ProfileImpl::ProfileImpl(const FilePath& path)
}
void ProfileImpl::InitExtensions() {
+ if (user_script_master_ || extensions_service_)
+ return; // Already initialized.
+
const CommandLine* command_line = CommandLine::ForCurrentProcess();
bool user_scripts_enabled =
command_line->HasSwitch(switches::kEnableUserScripts);
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index c910e30..3cf228d 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -26,6 +26,7 @@ const wchar_t kTestingInterfaceDLL[] = L"testing_interface.dll";
const wchar_t kNotSignedInProfile[] = L"Default";
const wchar_t kNotSignedInID[] = L"not-signed-in";
const wchar_t kBrowserResourcesDll[] = L"chrome.dll";
+const FilePath::CharType kExtensionFileExtension[] = FPL("crx");
// filenames
const wchar_t kArchivedHistoryFilename[] = L"Archived History";
diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h
index cd67441..51ac806 100644
--- a/chrome/common/chrome_constants.h
+++ b/chrome/common/chrome_constants.h
@@ -21,6 +21,7 @@ extern const wchar_t kNotSignedInProfile[];
extern const wchar_t kNotSignedInID[];
extern const char kStatsFilename[];
extern const wchar_t kBrowserResourcesDll[];
+extern const FilePath::CharType kExtensionFileExtension[];
// filenames
extern const wchar_t kArchivedHistoryFilename[];
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 64b49e2..23bdc5a 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -70,6 +70,27 @@ class RegistryEntry {
entries.push_front(new RegistryEntry(open_with_key, std::wstring()));
}
+ // Chrome extension installer
+ std::wstring install_cmd =
+ ShellUtil::GetChromeInstallExtensionCmd(chrome_exe);
+ std::wstring prog_id = std::wstring(L"Software\\Classes\\") +
+ ShellUtil::kChromeExtProgId;
+
+ // Extension file handler
+ entries.push_front(new RegistryEntry(prog_id,
+ ShellUtil::kChromeExtProgIdDesc));
+ entries.push_front(new RegistryEntry(
+ prog_id + L"\\DefaultIcon", icon_path));
+ entries.push_front(new RegistryEntry(
+ prog_id + L"\\shell\\open\\command", install_cmd));
+
+ // .crx file type extension
+ std::wstring file_extension_key(L"Software\\Classes\\");
+ file_extension_key.append(L".");
+ file_extension_key.append(chrome::kExtensionFileExtension);
+ entries.push_front(new RegistryEntry(file_extension_key,
+ ShellUtil::kChromeExtProgId));
+
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
entries.push_front(new RegistryEntry(
L"Software\\Clients\\StartMenuInternet\\chrome.exe",
@@ -358,6 +379,9 @@ const wchar_t* ShellUtil::kProtocolAssociations[] = {L"ftp", L"http", L"https",
NULL};
const wchar_t* ShellUtil::kRegUrlProtocol = L"URL Protocol";
+const wchar_t* ShellUtil::kChromeExtProgId = L"ChromeExt";
+const wchar_t* ShellUtil::kChromeExtProgIdDesc = L"Chrome Extension Installer";
+
ShellUtil::RegisterStatus ShellUtil::AddChromeToSetAccessDefaults(
const std::wstring& chrome_exe, bool skip_if_not_admin) {
if (IsChromeRegistered(chrome_exe))
@@ -390,6 +414,11 @@ std::wstring ShellUtil::GetChromeShellOpenCmd(const std::wstring& chrome_exe) {
return L"\"" + chrome_exe + L"\" -- \"%1\"";
}
+std::wstring ShellUtil::GetChromeInstallExtensionCmd(
+ const std::wstring& chrome_exe) {
+ return L"\"" + chrome_exe + L"\" --install-extension=\"%1\"";
+}
+
bool ShellUtil::GetChromeShortcutName(std::wstring* shortcut) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
shortcut->assign(dist->GetApplicationName());
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index 5539729..a8f6beb 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -72,6 +72,12 @@ class ShellUtil {
// Registry value name that is needed for ChromeHTML ProgId
static const wchar_t* kRegUrlProtocol;
+ // Name that we give to Chrome extension file association handler ProgId.
+ static const wchar_t* kChromeExtProgId;
+
+ // Description of Chrome file/URL association handler ProgId.
+ static const wchar_t* kChromeExtProgIdDesc;
+
// This method adds Chrome to the list that shows up in Add/Remove Programs->
// Set Program Access and Defaults and also creates Chrome ProgIds under
// Software\Classes. This method requires write access to HKLM so is just
@@ -128,6 +134,11 @@ class ShellUtil {
// chrome_exe: the full path to chrome.exe
static std::wstring GetChromeShellOpenCmd(const std::wstring& chrome_exe);
+ // This method returns the command to open .crx files using chrome in order
+ // to install them as extensions. Similar to above method.
+ static std::wstring GetChromeInstallExtensionCmd(
+ const std::wstring& chrome_exe);
+
// Returns the localized name of Chrome shortcut.
static bool GetChromeShortcutName(std::wstring* shortcut);