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

Side by Side Diff: chrome/browser/first_run/first_run_win.cc

Issue 3836005: Move pe_image and registry from base to base/win and use the namespace. It re... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/first_run/first_run.h" 5 #include "chrome/browser/first_run/first_run.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 10
11 #include <set> 11 #include <set>
12 #include <sstream> 12 #include <sstream>
13 13
14 #include "app/app_switches.h" 14 #include "app/app_switches.h"
15 #include "app/l10n_util.h" 15 #include "app/l10n_util.h"
16 #include "app/resource_bundle.h" 16 #include "app/resource_bundle.h"
17 #include "base/environment.h" 17 #include "base/environment.h"
18 #include "base/file_util.h" 18 #include "base/file_util.h"
19 #include "base/object_watcher.h" 19 #include "base/object_watcher.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/registry.h"
22 #include "base/scoped_comptr_win.h" 21 #include "base/scoped_comptr_win.h"
23 #include "base/scoped_ptr.h" 22 #include "base/scoped_ptr.h"
24 #include "base/string_number_conversions.h" 23 #include "base/string_number_conversions.h"
25 #include "base/string_split.h" 24 #include "base/string_split.h"
26 #include "base/utf_string_conversions.h" 25 #include "base/utf_string_conversions.h"
26 #include "base/win/registry.h"
27 #include "base/win/windows_version.h" 27 #include "base/win/windows_version.h"
28 #include "chrome/browser/extensions/extensions_service.h" 28 #include "chrome/browser/extensions/extensions_service.h"
29 #include "chrome/browser/extensions/extension_updater.h" 29 #include "chrome/browser/extensions/extension_updater.h"
30 #include "chrome/browser/importer/importer.h" 30 #include "chrome/browser/importer/importer.h"
31 #include "chrome/browser/metrics/user_metrics.h" 31 #include "chrome/browser/metrics/user_metrics.h"
32 #include "chrome/browser/process_singleton.h" 32 #include "chrome/browser/process_singleton.h"
33 #include "chrome/browser/profile.h" 33 #include "chrome/browser/profile.h"
34 #include "chrome/browser/views/first_run_search_engine_view.h" 34 #include "chrome/browser/views/first_run_search_engine_view.h"
35 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/notification_service.h" 36 #include "chrome/common/notification_service.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 if (!file_util::PathExists(new_chrome_exe)) 273 if (!file_util::PathExists(new_chrome_exe))
274 return false; 274 return false;
275 std::wstring curr_chrome_exe; 275 std::wstring curr_chrome_exe;
276 if (!PathService::Get(base::FILE_EXE, &curr_chrome_exe)) 276 if (!PathService::Get(base::FILE_EXE, &curr_chrome_exe))
277 return false; 277 return false;
278 278
279 // First try to rename exe by launching rename command ourselves. 279 // First try to rename exe by launching rename command ourselves.
280 bool user_install = InstallUtil::IsPerUserInstall(curr_chrome_exe.c_str()); 280 bool user_install = InstallUtil::IsPerUserInstall(curr_chrome_exe.c_str());
281 HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; 281 HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
282 BrowserDistribution *dist = BrowserDistribution::GetDistribution(); 282 BrowserDistribution *dist = BrowserDistribution::GetDistribution();
283 RegKey key; 283 base::win::RegKey key;
284 std::wstring rename_cmd; 284 std::wstring rename_cmd;
285 if (key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_READ) && 285 if (key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_READ) &&
286 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd)) { 286 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd)) {
287 base::ProcessHandle handle; 287 base::ProcessHandle handle;
288 if (base::LaunchApp(rename_cmd, true, true, &handle)) { 288 if (base::LaunchApp(rename_cmd, true, true, &handle)) {
289 DWORD exit_code; 289 DWORD exit_code;
290 ::GetExitCodeProcess(handle, &exit_code); 290 ::GetExitCodeProcess(handle, &exit_code);
291 ::CloseHandle(handle); 291 ::CloseHandle(handle);
292 if (exit_code == installer_util::RENAME_SUCCESSFUL) 292 if (exit_code == installer_util::RENAME_SUCCESSFUL)
293 return true; 293 return true;
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 852
853 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { 853 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) {
854 if (version > 10000) { 854 if (version > 10000) {
855 // This is a test value. We want to make sure we exercise 855 // This is a test value. We want to make sure we exercise
856 // returning this early. See EarlyReturnTest test harness. 856 // returning this early. See EarlyReturnTest test harness.
857 return Upgrade::TD_NOT_NOW; 857 return Upgrade::TD_NOT_NOW;
858 } 858 }
859 TryChromeDialog td(version); 859 TryChromeDialog td(version);
860 return td.ShowModal(); 860 return td.ShowModal();
861 } 861 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_registry_extension_provider_win.cc ('k') | chrome/browser/history/history_publisher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698