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

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

Issue 3076042: Use Environment::SetVar in more places. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: rebased to ToT Created 10 years, 4 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
« no previous file with comments | « chrome/browser/browser_main_win.cc ('k') | chrome/test/tab_switching/tab_switching_test.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) 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 // TODO(port): trim this include list once first run has been refactored fully. 14 // TODO(port): trim this include list once first run has been refactored fully.
15 #include "app/app_switches.h" 15 #include "app/app_switches.h"
16 #include "app/l10n_util.h" 16 #include "app/l10n_util.h"
17 #include "app/resource_bundle.h" 17 #include "app/resource_bundle.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/environment.h"
19 #include "base/file_util.h" 20 #include "base/file_util.h"
20 #include "base/logging.h" 21 #include "base/logging.h"
21 #include "base/object_watcher.h" 22 #include "base/object_watcher.h"
22 #include "base/path_service.h" 23 #include "base/path_service.h"
23 #include "base/process.h" 24 #include "base/process.h"
24 #include "base/process_util.h" 25 #include "base/process_util.h"
25 #include "base/registry.h" 26 #include "base/registry.h"
26 #include "base/scoped_comptr_win.h" 27 #include "base/scoped_comptr_win.h"
28 #include "base/scoped_ptr.h"
27 #include "base/string_number_conversions.h" 29 #include "base/string_number_conversions.h"
28 #include "base/string_util.h" 30 #include "base/string_util.h"
29 #include "base/utf_string_conversions.h" 31 #include "base/utf_string_conversions.h"
30 #include "base/win_util.h" 32 #include "base/win_util.h"
31 #include "chrome/common/chrome_constants.h" 33 #include "chrome/common/chrome_constants.h"
32 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/notification_registrar.h" 35 #include "chrome/common/notification_registrar.h"
34 #include "chrome/common/notification_service.h" 36 #include "chrome/common/notification_service.h"
35 #include "chrome/common/notification_type.h" 37 #include "chrome/common/notification_type.h"
36 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 std::transform(exe.begin(), exe.end(), exe.begin(), tolower); 418 std::transform(exe.begin(), exe.end(), exe.begin(), tolower);
417 exe = L"Global\\" + exe; 419 exe = L"Global\\" + exe;
418 if (handle != NULL) 420 if (handle != NULL)
419 CloseHandle(handle); 421 CloseHandle(handle);
420 handle = CreateEvent(NULL, TRUE, TRUE, exe.c_str()); 422 handle = CreateEvent(NULL, TRUE, TRUE, exe.c_str());
421 int error = GetLastError(); 423 int error = GetLastError();
422 return (error == ERROR_ALREADY_EXISTS || error == ERROR_ACCESS_DENIED); 424 return (error == ERROR_ALREADY_EXISTS || error == ERROR_ACCESS_DENIED);
423 } 425 }
424 426
425 bool Upgrade::RelaunchChromeBrowser(const CommandLine& command_line) { 427 bool Upgrade::RelaunchChromeBrowser(const CommandLine& command_line) {
426 ::SetEnvironmentVariable( 428 scoped_ptr<base::Environment> env(base::Environment::Create());
427 BrowserDistribution::GetDistribution()->GetEnvVersionKey().c_str(), 429 env->UnSetVar(WideToUTF8(
428 NULL); 430 BrowserDistribution::GetDistribution()->GetEnvVersionKey()).c_str());
429 return base::LaunchApp(command_line.command_line_string(), 431 return base::LaunchApp(command_line.command_line_string(),
430 false, false, NULL); 432 false, false, NULL);
431 } 433 }
432 434
433 bool Upgrade::SwapNewChromeExeIfPresent() { 435 bool Upgrade::SwapNewChromeExeIfPresent() {
434 FilePath new_chrome_exe; 436 FilePath new_chrome_exe;
435 if (!GetNewerChromeFile(&new_chrome_exe)) 437 if (!GetNewerChromeFile(&new_chrome_exe))
436 return false; 438 return false;
437 if (!file_util::PathExists(new_chrome_exe)) 439 if (!file_util::PathExists(new_chrome_exe))
438 return false; 440 return false;
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 1066
1065 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { 1067 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) {
1066 if (version > 10000) { 1068 if (version > 10000) {
1067 // This is a test value. We want to make sure we exercise 1069 // This is a test value. We want to make sure we exercise
1068 // returning this early. See EarlyReturnTest test harness. 1070 // returning this early. See EarlyReturnTest test harness.
1069 return Upgrade::TD_NOT_NOW; 1071 return Upgrade::TD_NOT_NOW;
1070 } 1072 }
1071 TryChromeDialog td; 1073 TryChromeDialog td;
1072 return td.ShowModal(); 1074 return td.ShowModal();
1073 } 1075 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_main_win.cc ('k') | chrome/test/tab_switching/tab_switching_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698