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

Side by Side Diff: cloud_print/common/win/install_utils.cc

Issue 1306603003: Redefine CreateFileVersionInfoForCurrentModule() as a macro on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a real macro Created 5 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cloud_print/common/win/install_utils.h" 5 #include "cloud_print/common/win/install_utils.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_version_info_win.h" 10 #include "base/file_version_info_win.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 base::win::RegKey key; 54 base::win::RegKey key;
55 if (key.Create(HKEY_LOCAL_MACHINE, 55 if (key.Create(HKEY_LOCAL_MACHINE,
56 (cloud_print::kClientsKey + product_id).c_str(), 56 (cloud_print::kClientsKey + product_id).c_str(),
57 KEY_SET_VALUE) != ERROR_SUCCESS) { 57 KEY_SET_VALUE) != ERROR_SUCCESS) {
58 LOG(ERROR) << "Unable to open key"; 58 LOG(ERROR) << "Unable to open key";
59 } 59 }
60 60
61 // Get the version from the resource file. 61 // Get the version from the resource file.
62 base::string16 version_string; 62 base::string16 version_string;
63 scoped_ptr<FileVersionInfo> version_info( 63 scoped_ptr<FileVersionInfo> version_info(
64 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); 64 CREATE_FILE_VERSION_INFO_FOR_CURRENT_MODULE());
65 65
66 if (version_info.get()) { 66 if (version_info.get()) {
67 FileVersionInfoWin* version_info_win = 67 FileVersionInfoWin* version_info_win =
68 static_cast<FileVersionInfoWin*>(version_info.get()); 68 static_cast<FileVersionInfoWin*>(version_info.get());
69 version_string = version_info_win->product_version(); 69 version_string = version_info_win->product_version();
70 } else { 70 } else {
71 LOG(ERROR) << "Unable to get version string"; 71 LOG(ERROR) << "Unable to get version string";
72 // Use a random version string so that Google Update has something to go by. 72 // Use a random version string so that Google Update has something to go by.
73 version_string = L"0.0.0.99"; 73 version_string = L"0.0.0.99";
74 } 74 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 base::CommandLine uninstall_command(unstall_binary); 146 base::CommandLine uninstall_command(unstall_binary);
147 uninstall_command.AppendSwitch(uninstall_switch); 147 uninstall_command.AppendSwitch(uninstall_switch);
148 key.WriteValue(kUninstallString, 148 key.WriteValue(kUninstallString,
149 uninstall_command.GetCommandLineString().c_str()); 149 uninstall_command.GetCommandLineString().c_str());
150 key.WriteValue(kInstallLocation, 150 key.WriteValue(kInstallLocation,
151 unstall_binary.DirName().value().c_str()); 151 unstall_binary.DirName().value().c_str());
152 152
153 // Get the version resource. 153 // Get the version resource.
154 scoped_ptr<FileVersionInfo> version_info( 154 scoped_ptr<FileVersionInfo> version_info(
155 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); 155 CREATE_FILE_VERSION_INFO_FOR_CURRENT_MODULE());
156 156
157 if (version_info.get()) { 157 if (version_info.get()) {
158 FileVersionInfoWin* version_info_win = 158 FileVersionInfoWin* version_info_win =
159 static_cast<FileVersionInfoWin*>(version_info.get()); 159 static_cast<FileVersionInfoWin*>(version_info.get());
160 key.WriteValue(kDisplayVersion, 160 key.WriteValue(kDisplayVersion,
161 version_info_win->file_version().c_str()); 161 version_info_win->file_version().c_str());
162 key.WriteValue(kPublisher, version_info_win->company_name().c_str()); 162 key.WriteValue(kPublisher, version_info_win->company_name().c_str());
163 } else { 163 } else {
164 LOG(ERROR) << "Unable to get version string"; 164 LOG(ERROR) << "Unable to get version string";
165 } 165 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 bool IsProgramsFilesParent(const base::FilePath& path) { 210 bool IsProgramsFilesParent(const base::FilePath& path) {
211 base::FilePath program_files; 211 base::FilePath program_files;
212 if (!PathService::Get(base::DIR_PROGRAM_FILESX86, &program_files)) 212 if (!PathService::Get(base::DIR_PROGRAM_FILESX86, &program_files))
213 return false; 213 return false;
214 return program_files.IsParent(path); 214 return program_files.IsParent(path);
215 } 215 }
216 216
217 } // namespace cloud_print 217 } // namespace cloud_print
218 218
OLDNEW
« no previous file with comments | « chrome/chrome_watcher/chrome_watcher_main.cc ('k') | cloud_print/virtual_driver/win/install/setup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698