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

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

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/installer/util/channel_info.h" 5 #include "chrome/installer/util/channel_info.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/win/registry.h" 8 #include "base/win/registry.h"
9 #include "chrome/installer/util/google_update_constants.h" 9 #include "chrome/installer/util/google_update_constants.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } else { 56 } else {
57 if (position != std::wstring::npos) { 57 if (position != std::wstring::npos) {
58 ap_value->erase(position, std::wstring::traits_type::length(modifier)); 58 ap_value->erase(position, std::wstring::traits_type::length(modifier));
59 return true; 59 return true;
60 } 60 }
61 } 61 }
62 return false; 62 return false;
63 } 63 }
64 64
65 bool ChannelInfo::Initialize(const RegKey& key) { 65 bool ChannelInfo::Initialize(const RegKey& key) {
66 return key.ReadValue(google_update::kRegApField, &value_); 66 return key.ReadValue(google_update::kRegApField, &value_) == ERROR_SUCCESS;
67 } 67 }
68 68
69 bool ChannelInfo::Write(RegKey* key) const { 69 bool ChannelInfo::Write(RegKey* key) const {
70 return key->WriteValue(google_update::kRegApField, value_.c_str()); 70 LONG result = key->WriteValue(google_update::kRegApField, value_.c_str());
71 return result == ERROR_SUCCESS;
71 } 72 }
72 73
73 bool ChannelInfo::GetChannelName(std::wstring* channel_name) const { 74 bool ChannelInfo::GetChannelName(std::wstring* channel_name) const {
74 DCHECK(channel_name); 75 DCHECK(channel_name);
75 if (value_.empty()) { 76 if (value_.empty()) {
76 channel_name->erase(); 77 channel_name->erase();
77 return true; 78 return true;
78 } else { 79 } else {
79 for (const wchar_t* const* scan = &kChannels[0], 80 for (const wchar_t* const* scan = &kChannels[0],
80 *const* end = &kChannels[arraysize(kChannels)]; scan != end; 81 *const* end = &kChannels[arraysize(kChannels)]; scan != end;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 120
120 bool ChannelInfo::IsMultiInstall() const { 121 bool ChannelInfo::IsMultiInstall() const {
121 return HasModifier(kModMultiInstall, value_); 122 return HasModifier(kModMultiInstall, value_);
122 } 123 }
123 124
124 bool ChannelInfo::SetMultiInstall(bool value) { 125 bool ChannelInfo::SetMultiInstall(bool value) {
125 return SetModifier(kModMultiInstall, value, &value_); 126 return SetModifier(kModMultiInstall, value, &value_);
126 } 127 }
127 128
128 } // namespace installer 129 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698