security/sandbox/chromium/base/file_version_info.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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
     3 // found in the LICENSE file.
     5 #ifndef BASE_FILE_VERSION_INFO_H__
     6 #define BASE_FILE_VERSION_INFO_H__
     8 #include "build/build_config.h"
    10 #if defined(OS_WIN)
    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
    16 #include <string>
    18 #include "base/base_export.h"
    19 #include "base/strings/string16.h"
    21 namespace base {
    22 class FilePath;
    23 }
    25 // Provides an interface for accessing the version information for a file. This
    26 // is the information you access when you select a file in the Windows Explorer,
    27 // right-click select Properties, then click the Version tab, and on the Mac
    28 // when you select a file in the Finder and do a Get Info.
    29 //
    30 // This list of properties is straight out of Win32's VerQueryValue
    31 // <http://msdn.microsoft.com/en-us/library/ms647464.aspx> and the Mac
    32 // version returns values from the Info.plist as appropriate. TODO(avi): make
    33 // this a less-obvious Windows-ism.
    35 class FileVersionInfo {
    36  public:
    37   virtual ~FileVersionInfo() {}
    38 #if defined(OS_WIN) || defined(OS_MACOSX)
    39   // Creates a FileVersionInfo for the specified path. Returns NULL if something
    40   // goes wrong (typically the file does not exit or cannot be opened). The
    41   // returned object should be deleted when you are done with it.
    42   BASE_EXPORT static FileVersionInfo* CreateFileVersionInfo(
    43       const base::FilePath& file_path);
    44 #endif  // OS_WIN || OS_MACOSX
    46 #if defined(OS_WIN)
    47   // Creates a FileVersionInfo for the specified module. Returns NULL in case
    48   // of error. The returned object should be deleted when you are done with it.
    49   BASE_EXPORT static FileVersionInfo* CreateFileVersionInfoForModule(
    50       HMODULE module);
    52   // Creates a FileVersionInfo for the current module. Returns NULL in case
    53   // of error. The returned object should be deleted when you are done with it.
    54   // This function should be inlined so that the "current module" is evaluated
    55   // correctly, instead of being the module that contains base.
    56   __forceinline static FileVersionInfo*
    57   CreateFileVersionInfoForCurrentModule() {
    58     HMODULE module = reinterpret_cast<HMODULE>(&__ImageBase);
    59     return CreateFileVersionInfoForModule(module);
    60   }
    61 #else
    62   // Creates a FileVersionInfo for the current module. Returns NULL in case
    63   // of error. The returned object should be deleted when you are done with it.
    64   BASE_EXPORT static FileVersionInfo* CreateFileVersionInfoForCurrentModule();
    65 #endif  // OS_WIN
    67   // Accessors to the different version properties.
    68   // Returns an empty string if the property is not found.
    69   virtual string16 company_name() = 0;
    70   virtual string16 company_short_name() = 0;
    71   virtual string16 product_name() = 0;
    72   virtual string16 product_short_name() = 0;
    73   virtual string16 internal_name() = 0;
    74   virtual string16 product_version() = 0;
    75   virtual string16 private_build() = 0;
    76   virtual string16 special_build() = 0;
    77   virtual string16 comments() = 0;
    78   virtual string16 original_filename() = 0;
    79   virtual string16 file_description() = 0;
    80   virtual string16 file_version() = 0;
    81   virtual string16 legal_copyright() = 0;
    82   virtual string16 legal_trademarks() = 0;
    83   virtual string16 last_change() = 0;
    84   virtual bool is_official_build() = 0;
    85 };
    87 #endif  // BASE_FILE_VERSION_INFO_H__

mercurial