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

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

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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.cc ('k') | chrome/installer/util/installer_state.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 #include "chrome/installer/util/installation_state.h" 5 #include "chrome/installer/util/installation_state.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h"
9 #include "base/version.h" 10 #include "base/version.h"
10 #include "base/win/registry.h" 11 #include "base/win/registry.h"
11 #include "chrome/installer/util/google_update_constants.h" 12 #include "chrome/installer/util/google_update_constants.h"
12 #include "chrome/installer/util/install_util.h" 13 #include "chrome/installer/util/install_util.h"
13 14
14 namespace installer { 15 namespace installer {
15 16
16 ProductState::ProductState() 17 ProductState::ProductState()
17 : uninstall_command_(CommandLine::NO_PROGRAM), 18 : uninstall_command_(CommandLine::NO_PROGRAM),
18 eula_accepted_(0), 19 eula_accepted_(0),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 const std::wstring state_key(distribution->GetStateKey()); 51 const std::wstring state_key(distribution->GetStateKey());
51 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 52 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
52 base::win::RegKey key; 53 base::win::RegKey key;
53 54
54 // Clear the runway. 55 // Clear the runway.
55 Clear(); 56 Clear();
56 57
57 // Read from the Clients key. 58 // Read from the Clients key.
58 if (key.Open(root_key, version_key.c_str(), 59 if (key.Open(root_key, version_key.c_str(),
59 KEY_QUERY_VALUE) == ERROR_SUCCESS) { 60 KEY_QUERY_VALUE) == ERROR_SUCCESS) {
60 std::wstring version_str; 61 base::string16 version_str;
61 if (key.ReadValue(google_update::kRegVersionField, 62 if (key.ReadValue(google_update::kRegVersionField,
62 &version_str) == ERROR_SUCCESS) { 63 &version_str) == ERROR_SUCCESS) {
63 version_.reset(new Version(WideToASCII(version_str))); 64 version_.reset(new Version(base::UTF16ToASCII(version_str)));
64 if (!version_->IsValid()) 65 if (!version_->IsValid())
65 version_.reset(); 66 version_.reset();
66 } 67 }
67 68
68 // Attempt to read the other values even if the "pv" version value was 69 // Attempt to read the other values even if the "pv" version value was
69 // absent. Note that ProductState instances containing these values will 70 // absent. Note that ProductState instances containing these values will
70 // only be accessible via InstallationState::GetNonVersionedProductState. 71 // only be accessible via InstallationState::GetNonVersionedProductState.
71 if (key.ReadValue(google_update::kRegOldVersionField, 72 if (key.ReadValue(google_update::kRegOldVersionField,
72 &version_str) == ERROR_SUCCESS) { 73 &version_str) == ERROR_SUCCESS) {
73 old_version_.reset(new Version(WideToASCII(version_str))); 74 old_version_.reset(new Version(base::UTF16ToASCII(version_str)));
74 if (!old_version_->IsValid()) 75 if (!old_version_->IsValid())
75 old_version_.reset(); 76 old_version_.reset();
76 } 77 }
77 78
78 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd_); 79 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd_);
79 if (!InitializeCommands(key, &commands_)) 80 if (!InitializeCommands(key, &commands_))
80 commands_.Clear(); 81 commands_.Clear();
81 } 82 }
82 83
83 // Read from the ClientState key. 84 // Read from the ClientState key.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } 269 }
269 270
270 const ProductState* InstallationState::GetProductState( 271 const ProductState* InstallationState::GetProductState(
271 bool system_install, 272 bool system_install,
272 BrowserDistribution::Type type) const { 273 BrowserDistribution::Type type) const {
273 const ProductState* product_state = 274 const ProductState* product_state =
274 GetNonVersionedProductState(system_install, type); 275 GetNonVersionedProductState(system_install, type);
275 return product_state->version_.get() == NULL ? NULL : product_state; 276 return product_state->version_.get() == NULL ? NULL : product_state;
276 } 277 }
277 } // namespace installer 278 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/install_util.cc ('k') | chrome/installer/util/installer_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698