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

Side by Side Diff: chrome/installer/util/install_util.cc

Issue 10213010: Don't register or use the DelegateExecute verb handler if it isn't present. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar logging tweaks Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | chrome/installer/util/shell_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // See the corresponding header file for description of the functions in this 5 // See the corresponding header file for description of the functions in this
6 // file. 6 // file.
7 7
8 #include "chrome/installer/util/install_util.h" 8 #include "chrome/installer/util/install_util.h"
9 9
10 #include <shellapi.h> 10 #include <shellapi.h>
11 #include <shlobj.h> 11 #include <shlobj.h>
12 #include <shlwapi.h> 12 #include <shlwapi.h>
13 13
14 #include <algorithm> 14 #include <algorithm>
15 15
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/file_util.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
19 #include "base/path_service.h" 20 #include "base/path_service.h"
20 #include "base/string_util.h" 21 #include "base/string_util.h"
21 #include "base/sys_info.h" 22 #include "base/sys_info.h"
22 #include "base/values.h" 23 #include "base/values.h"
23 #include "base/version.h" 24 #include "base/version.h"
24 #include "base/win/registry.h" 25 #include "base/win/registry.h"
25 #include "base/win/windows_version.h" 26 #include "base/win/windows_version.h"
26 #include "chrome/installer/util/browser_distribution.h" 27 #include "chrome/installer/util/browser_distribution.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 installer::kInstallBinaryDir) && 332 installer::kInstallBinaryDir) &&
332 FilePath::CompareEqualIgnoreCase(exe_dir.DirName().BaseName().value(), 333 FilePath::CompareEqualIgnoreCase(exe_dir.DirName().BaseName().value(),
333 chrome_sxs_dir); 334 chrome_sxs_dir);
334 } 335 }
335 336
336 bool InstallUtil::IsChromeSxSProcess() { 337 bool InstallUtil::IsChromeSxSProcess() {
337 static bool sxs = CheckIsChromeSxSProcess(); 338 static bool sxs = CheckIsChromeSxSProcess();
338 return sxs; 339 return sxs;
339 } 340 }
340 341
342 bool InstallUtil::HasDelegateExecuteHandler(BrowserDistribution* dist,
343 const string16& chrome_exe) {
344 bool found = false;
345 bool system_install = !IsPerUserInstall(chrome_exe.c_str());
346 scoped_ptr<Version> version(GetChromeVersion(dist, system_install));
347 if (!version.get()) {
348 LOG(ERROR) << __FUNCTION__ << " failed to determine version of "
349 << dist->GetAppShortCutName() << " installed at " << chrome_exe;
350 } else {
351 FilePath handler(
352 FilePath(chrome_exe).DirName()
353 .AppendASCII(version->GetString())
354 .Append(installer::kDelegateExecuteExe));
355 found = file_util::PathExists(handler);
356 }
357 return found;
358 }
359
341 // This method tries to delete a registry key and logs an error message 360 // This method tries to delete a registry key and logs an error message
342 // in case of failure. It returns true if deletion is successful, 361 // in case of failure. It returns true if deletion is successful,
343 // otherwise false. 362 // otherwise false.
344 bool InstallUtil::DeleteRegistryKey(HKEY root_key, 363 bool InstallUtil::DeleteRegistryKey(HKEY root_key,
345 const std::wstring& key_path) { 364 const std::wstring& key_path) {
346 VLOG(1) << "Deleting registry key " << key_path; 365 VLOG(1) << "Deleting registry key " << key_path;
347 LONG result = ::SHDeleteKey(root_key, key_path.c_str()); 366 LONG result = ::SHDeleteKey(root_key, key_path.c_str());
348 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { 367 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
349 LOG(ERROR) << "Failed to delete registry key: " << key_path 368 LOG(ERROR) << "Failed to delete registry key: " << key_path
350 << " error: " << result; 369 << " error: " << result;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, 471 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat,
453 date_str, arraysize(date_str)); 472 date_str, arraysize(date_str));
454 if (len) { 473 if (len) {
455 --len; // Subtract terminating \0. 474 --len; // Subtract terminating \0.
456 } else { 475 } else {
457 PLOG(DFATAL) << "GetDateFormat"; 476 PLOG(DFATAL) << "GetDateFormat";
458 } 477 }
459 478
460 return std::wstring(date_str, len); 479 return std::wstring(date_str, len);
461 } 480 }
OLDNEW
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | chrome/installer/util/shell_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698