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

Unified Diff: chrome/installer/setup/install.cc

Issue 12398024: Do not try to make Chrome default when registering it if it can't be made default unattended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 10 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 | « chrome/installer/setup/install.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/setup/install.cc
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index aa789447e8ca09045712fa129d76e0efa8684a5f..1bc9564b430493ab209904abc4ddc5d0967058f4 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -7,7 +7,6 @@
#include <windows.h>
#include <shlobj.h>
#include <time.h>
-#include <winuser.h>
#include <string>
@@ -148,27 +147,6 @@ void CopyPreferenceFileForFirstRun(const InstallerState& installer_state,
}
}
-// Returns true if the current process is running on the interactive window
-// station. This cares not whether the input desktop is the default or not
-// (i.e., the screen saver is running, or what have you).
-bool IsInteractiveProcess() {
- static const wchar_t kWinSta0[] = L"WinSta0";
- HWINSTA window_station = ::GetProcessWindowStation();
- if (window_station == NULL) {
- PLOG(ERROR) << "Failed to get window station";
- return false;
- }
-
- // Make the buffer one char longer and zero it to be certain it's terminated.
- wchar_t name[arraysize(kWinSta0) + 1] = {};
- DWORD buffer_length = sizeof(kWinSta0);
- DWORD name_length = 0;
- return (GetUserObjectInformation(window_station, UOI_NAME, &name[0],
- buffer_length, &name_length) &&
- name_length == buffer_length &&
- lstrcmpi(kWinSta0, name) == 0);
-}
-
// This function installs a new version of Chrome to the specified location.
//
// setup_path: Path to the executable (setup.exe) as it will be copied
@@ -483,17 +461,11 @@ void RegisterChromeOnMachine(const InstallerState& installer_state,
const string16 chrome_exe(
installer_state.target_path().Append(installer::kChromeExe).value());
VLOG(1) << "Registering Chrome as browser: " << chrome_exe;
- if (make_chrome_default) {
- if (ShellUtil::CanMakeChromeDefaultUnattended()) {
- int level = ShellUtil::CURRENT_USER;
- if (installer_state.system_install())
- level = level | ShellUtil::SYSTEM_LEVEL;
- ShellUtil::MakeChromeDefault(dist, level, chrome_exe, true);
- } else if (IsInteractiveProcess()) {
- ShellUtil::ShowMakeChromeDefaultSystemUI(dist, chrome_exe);
- } else {
- ShellUtil::RegisterChromeBrowser(dist, chrome_exe, string16(), false);
- }
+ if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) {
+ int level = ShellUtil::CURRENT_USER;
+ if (installer_state.system_install())
+ level = level | ShellUtil::SYSTEM_LEVEL;
+ ShellUtil::MakeChromeDefault(dist, level, chrome_exe, true);
} else {
ShellUtil::RegisterChromeBrowser(dist, chrome_exe, string16(), false);
}
« no previous file with comments | « chrome/installer/setup/install.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698