1 // Copyright (c) 2012 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 // This file defines utility functions that can report details about the
6 // host operating environment.
8 #ifndef CHROME_APP_CLIENT_UTIL_H_
9 #define CHROME_APP_CLIENT_UTIL_H_
13 #include "base/strings/string16.h"
16 struct SandboxInterfaceInfo
;
19 // Gets the path of the current exe with a trailing backslash.
20 base::string16
GetExecutablePath();
22 // Returns the version in the current module's version resource or the empty
23 // string if none found.
24 base::string16
GetCurrentModuleVersion();
26 // Implements the common aspects of loading chrome.dll for both chrome and
27 // chromium scenarios, which are in charge of implementing two abstract
28 // methods: GetRegistryPath() and OnBeforeLaunch().
32 virtual ~MainDllLoader();
34 // Loads and calls the entry point of chrome.dll. |instance| is the exe
35 // instance retrieved from wWinMain and the |sbox_info| is the broker or
36 // target services interface pointer.
37 // The return value is what the main entry point of chrome.dll returns
39 int Launch(HINSTANCE instance
, sandbox::SandboxInterfaceInfo
* sbox_info
);
41 // Launches a new instance of the browser if the current instance in
42 // persistent mode an upgrade is detected.
43 void RelaunchChromeBrowserWithNewCommandLineIfNeeded();
45 // Called after chrome.dll has been loaded but before the entry point
46 // is invoked. Derived classes can implement custom actions here.
47 // |dll_path| refers to the path of the Chrome dll being loaded.
48 virtual void OnBeforeLaunch(const base::string16
& dll_path
) {}
50 // Called after the chrome.dll entry point returns and before terminating
51 // this process. The return value will be used as the process return code.
52 // |dll_path| refers to the path of the Chrome dll being loaded.
53 virtual int OnBeforeExit(int return_code
, const base::string16
& dll_path
) {
58 // Derived classes must return the relative registry path that holds the
59 // most current version of chrome.dll.
60 virtual base::string16
GetRegistryPath() = 0;
62 HMODULE
Load(base::string16
* out_version
, base::string16
* out_file
);
69 // Factory for the MainDllLoader. Caller owns the pointer and should call
71 MainDllLoader
* MakeMainDllLoader();
73 #endif // CHROME_APP_CLIENT_UTIL_H_