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

Side by Side Diff: base/file_version_info.h

Issue 6897016: Base: Fix FileVersionInfo::CreateFileVersionInfoForCurrentModule so that (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | « no previous file | base/file_version_info_win.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_FILE_VERSION_INFO_H__ 5 #ifndef BASE_FILE_VERSION_INFO_H__
6 #define BASE_FILE_VERSION_INFO_H__ 6 #define BASE_FILE_VERSION_INFO_H__
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h"
10 #if defined(OS_WIN)
brettw 2011/04/22 21:43:34 Can you put a blank line above this?
rvargas (doing something else) 2011/04/22 22:06:43 Done.
11 #include <windows.h>
12 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
13 extern "C" IMAGE_DOS_HEADER __ImageBase;
14 #endif // OS_WIN
15
9 #include <string> 16 #include <string>
10 17
11 #include "base/base_api.h" 18 #include "base/base_api.h"
12 #include "base/string16.h" 19 #include "base/string16.h"
13 #include "build/build_config.h"
14 20
15 class FilePath; 21 class FilePath;
16 22
17 // Provides an interface for accessing the version information for a file. This 23 // Provides an interface for accessing the version information for a file. This
18 // is the information you access when you select a file in the Windows Explorer, 24 // is the information you access when you select a file in the Windows Explorer,
19 // right-click select Properties, then click the Version tab, and on the Mac 25 // right-click select Properties, then click the Version tab, and on the Mac
20 // when you select a file in the Finder and do a Get Info. 26 // when you select a file in the Finder and do a Get Info.
21 // 27 //
22 // This list of properties is straight out of Win32's VerQueryValue 28 // This list of properties is straight out of Win32's VerQueryValue
23 // <http://msdn.microsoft.com/en-us/library/ms647464.aspx> and the Mac 29 // <http://msdn.microsoft.com/en-us/library/ms647464.aspx> and the Mac
24 // version returns values from the Info.plist as appropriate. TODO(avi): make 30 // version returns values from the Info.plist as appropriate. TODO(avi): make
25 // this a less-obvious Windows-ism. 31 // this a less-obvious Windows-ism.
26 32
27 class BASE_API FileVersionInfo { 33 class FileVersionInfo {
28 public: 34 public:
29 virtual ~FileVersionInfo() {} 35 virtual ~FileVersionInfo() {}
30 #if defined(OS_WIN) || defined(OS_MACOSX) 36 #if defined(OS_WIN) || defined(OS_MACOSX)
31 // Creates a FileVersionInfo for the specified path. Returns NULL if something 37 // Creates a FileVersionInfo for the specified path. Returns NULL if something
32 // goes wrong (typically the file does not exit or cannot be opened). The 38 // goes wrong (typically the file does not exit or cannot be opened). The
33 // returned object should be deleted when you are done with it. 39 // returned object should be deleted when you are done with it.
34 static FileVersionInfo* CreateFileVersionInfo(const FilePath& file_path); 40 BASE_API static FileVersionInfo* CreateFileVersionInfo(
41 const FilePath& file_path);
35 #endif // OS_WIN || OS_MACOSX 42 #endif // OS_WIN || OS_MACOSX
36 43
44 #if defined(OS_WIN)
45 // Creates a FileVersionInfo for the specified module. Returns NULL in case
46 // of error. The returned object should be deleted when you are done with it.
47 BASE_API static FileVersionInfo* CreateFileVersionInfoForModule(
48 HMODULE module);
49
37 // Creates a FileVersionInfo for the current module. Returns NULL in case 50 // Creates a FileVersionInfo for the current module. Returns NULL in case
38 // of error. The returned object should be deleted when you are done with it. 51 // of error. The returned object should be deleted when you are done with it.
52 inline static FileVersionInfo* CreateFileVersionInfoForCurrentModule() {
53 HMODULE module = reinterpret_cast<HMODULE>(&__ImageBase);
54 return CreateFileVersionInfoForModule(module);
55 }
56 #else
57 // Creates a FileVersionInfo for the current module. Returns NULL in case
58 // of error. The returned object should be deleted when you are done with it.
39 static FileVersionInfo* CreateFileVersionInfoForCurrentModule(); 59 static FileVersionInfo* CreateFileVersionInfoForCurrentModule();
60 #endif // OS_WIN
40 61
41 // Accessors to the different version properties. 62 // Accessors to the different version properties.
42 // Returns an empty string if the property is not found. 63 // Returns an empty string if the property is not found.
43 virtual string16 company_name() = 0; 64 virtual string16 company_name() = 0;
44 virtual string16 company_short_name() = 0; 65 virtual string16 company_short_name() = 0;
45 virtual string16 product_name() = 0; 66 virtual string16 product_name() = 0;
46 virtual string16 product_short_name() = 0; 67 virtual string16 product_short_name() = 0;
47 virtual string16 internal_name() = 0; 68 virtual string16 internal_name() = 0;
48 virtual string16 product_version() = 0; 69 virtual string16 product_version() = 0;
49 virtual string16 private_build() = 0; 70 virtual string16 private_build() = 0;
50 virtual string16 special_build() = 0; 71 virtual string16 special_build() = 0;
51 virtual string16 comments() = 0; 72 virtual string16 comments() = 0;
52 virtual string16 original_filename() = 0; 73 virtual string16 original_filename() = 0;
53 virtual string16 file_description() = 0; 74 virtual string16 file_description() = 0;
54 virtual string16 file_version() = 0; 75 virtual string16 file_version() = 0;
55 virtual string16 legal_copyright() = 0; 76 virtual string16 legal_copyright() = 0;
56 virtual string16 legal_trademarks() = 0; 77 virtual string16 legal_trademarks() = 0;
57 virtual string16 last_change() = 0; 78 virtual string16 last_change() = 0;
58 virtual bool is_official_build() = 0; 79 virtual bool is_official_build() = 0;
59 }; 80 };
60 81
61 #endif // BASE_FILE_VERSION_INFO_H__ 82 #endif // BASE_FILE_VERSION_INFO_H__
OLDNEW
« no previous file with comments | « no previous file | base/file_version_info_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698