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

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

Issue 1281313003: base: Remove using:: declaration from version.h header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 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
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/strings/utf_string_conversions.h"
10 #include "base/version.h" 10 #include "base/version.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 base::win::RegKey key; 58 base::win::RegKey key;
59 59
60 // Clear the runway. 60 // Clear the runway.
61 Clear(); 61 Clear();
62 62
63 // Read from the Clients key. 63 // Read from the Clients key.
64 if (key.Open(root_key, version_key.c_str(), kAccess) == ERROR_SUCCESS) { 64 if (key.Open(root_key, version_key.c_str(), kAccess) == ERROR_SUCCESS) {
65 base::string16 version_str; 65 base::string16 version_str;
66 if (key.ReadValue(google_update::kRegVersionField, 66 if (key.ReadValue(google_update::kRegVersionField,
67 &version_str) == ERROR_SUCCESS) { 67 &version_str) == ERROR_SUCCESS) {
68 version_.reset(new Version(base::UTF16ToASCII(version_str))); 68 version_.reset(new base::Version(base::UTF16ToASCII(version_str)));
69 if (!version_->IsValid()) 69 if (!version_->IsValid())
70 version_.reset(); 70 version_.reset();
71 } 71 }
72 72
73 // Attempt to read the other values even if the "pv" version value was 73 // Attempt to read the other values even if the "pv" version value was
74 // absent. Note that ProductState instances containing these values will 74 // absent. Note that ProductState instances containing these values will
75 // only be accessible via InstallationState::GetNonVersionedProductState. 75 // only be accessible via InstallationState::GetNonVersionedProductState.
76 if (key.ReadValue(google_update::kRegOldVersionField, 76 if (key.ReadValue(google_update::kRegOldVersionField,
77 &version_str) == ERROR_SUCCESS) { 77 &version_str) == ERROR_SUCCESS) {
78 old_version_.reset(new Version(base::UTF16ToASCII(version_str))); 78 old_version_.reset(new base::Version(base::UTF16ToASCII(version_str)));
79 if (!old_version_->IsValid()) 79 if (!old_version_->IsValid())
80 old_version_.reset(); 80 old_version_.reset();
81 } 81 }
82 82
83 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd_); 83 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd_);
84 if (!InitializeCommands(key, &commands_)) 84 if (!InitializeCommands(key, &commands_))
85 commands_.Clear(); 85 commands_.Clear();
86 } 86 }
87 87
88 // Read from the ClientState key. 88 // Read from the ClientState key.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 } 145 }
146 146
147 return version_.get() != NULL; 147 return version_.get() != NULL;
148 } 148 }
149 149
150 base::FilePath ProductState::GetSetupPath() const { 150 base::FilePath ProductState::GetSetupPath() const {
151 return uninstall_command_.GetProgram(); 151 return uninstall_command_.GetProgram();
152 } 152 }
153 153
154 const Version& ProductState::version() const { 154 const base::Version& ProductState::version() const {
155 DCHECK(version_.get() != NULL); 155 DCHECK(version_.get() != NULL);
156 return *version_; 156 return *version_;
157 } 157 }
158 158
159 ProductState& ProductState::CopyFrom(const ProductState& other) { 159 ProductState& ProductState::CopyFrom(const ProductState& other) {
160 channel_.set_value(other.channel_.value()); 160 channel_.set_value(other.channel_.value());
161 version_.reset(other.version_.get() ? new Version(*other.version_) : NULL); 161 version_.reset(other.version_.get() ? new base::Version(*other.version_)
162 : NULL);
162 old_version_.reset( 163 old_version_.reset(
163 other.old_version_.get() ? new Version(*other.old_version_) : NULL); 164 other.old_version_.get() ? new base::Version(*other.old_version_) : NULL);
164 brand_ = other.brand_; 165 brand_ = other.brand_;
165 rename_cmd_ = other.rename_cmd_; 166 rename_cmd_ = other.rename_cmd_;
166 uninstall_command_ = other.uninstall_command_; 167 uninstall_command_ = other.uninstall_command_;
167 oem_install_ = other.oem_install_; 168 oem_install_ = other.oem_install_;
168 commands_.CopyFrom(other.commands_); 169 commands_.CopyFrom(other.commands_);
169 eula_accepted_ = other.eula_accepted_; 170 eula_accepted_ = other.eula_accepted_;
170 usagestats_ = other.usagestats_; 171 usagestats_ = other.usagestats_;
171 msi_ = other.msi_; 172 msi_ = other.msi_;
172 multi_install_ = other.multi_install_; 173 multi_install_ = other.multi_install_;
173 has_eula_accepted_ = other.has_eula_accepted_; 174 has_eula_accepted_ = other.has_eula_accepted_;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 265 }
265 266
266 const ProductState* InstallationState::GetProductState( 267 const ProductState* InstallationState::GetProductState(
267 bool system_install, 268 bool system_install,
268 BrowserDistribution::Type type) const { 269 BrowserDistribution::Type type) const {
269 const ProductState* product_state = 270 const ProductState* product_state =
270 GetNonVersionedProductState(system_install, type); 271 GetNonVersionedProductState(system_install, type);
271 return product_state->version_.get() == NULL ? NULL : product_state; 272 return product_state->version_.get() == NULL ? NULL : product_state;
272 } 273 }
273 } // namespace installer 274 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/installation_state.h ('k') | chrome/installer/util/installation_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698