Home | History | Annotate | Download | only in base
      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.
      4 
      5 #ifndef BASE_FILE_VERSION_INFO_H__
      6 #define BASE_FILE_VERSION_INFO_H__
      7 #pragma once
      8 
      9 #include <string>
     10 
     11 #include "base/base_api.h"
     12 #include "base/string16.h"
     13 #include "build/build_config.h"
     14 
     15 class FilePath;
     16 
     17 // 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,
     19 // 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.
     21 //
     22 // This list of properties is straight out of Win32's VerQueryValue
     23 // <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
     25 // this a less-obvious Windows-ism.
     26 
     27 class BASE_API FileVersionInfo {
     28  public:
     29   virtual ~FileVersionInfo() {}
     30 #if defined(OS_WIN) || defined(OS_MACOSX)
     31   // 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
     33   // returned object should be deleted when you are done with it.
     34   static FileVersionInfo* CreateFileVersionInfo(const FilePath& file_path);
     35 #endif  // OS_WIN || OS_MACOSX
     36 
     37   // 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.
     39   static FileVersionInfo* CreateFileVersionInfoForCurrentModule();
     40 
     41   // Accessors to the different version properties.
     42   // Returns an empty string if the property is not found.
     43   virtual string16 company_name() = 0;
     44   virtual string16 company_short_name() = 0;
     45   virtual string16 product_name() = 0;
     46   virtual string16 product_short_name() = 0;
     47   virtual string16 internal_name() = 0;
     48   virtual string16 product_version() = 0;
     49   virtual string16 private_build() = 0;
     50   virtual string16 special_build() = 0;
     51   virtual string16 comments() = 0;
     52   virtual string16 original_filename() = 0;
     53   virtual string16 file_description() = 0;
     54   virtual string16 file_version() = 0;
     55   virtual string16 legal_copyright() = 0;
     56   virtual string16 legal_trademarks() = 0;
     57   virtual string16 last_change() = 0;
     58   virtual bool is_official_build() = 0;
     59 };
     60 
     61 #endif  // BASE_FILE_VERSION_INFO_H__
     62