summaryrefslogtreecommitdiffstats
path: root/chrome/app/client_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/app/client_util.h')
-rw-r--r--chrome/app/client_util.h68
1 files changed, 38 insertions, 30 deletions
diff --git a/chrome/app/client_util.h b/chrome/app/client_util.h
index b3ab7e7..c4d74d2 100644
--- a/chrome/app/client_util.h
+++ b/chrome/app/client_util.h
@@ -9,37 +9,45 @@
#define CHROME_APP_CLIENT_UTIL_H_
#include <windows.h>
-
#include <string>
-#include "sandbox/src/sandbox_factory.h"
-
-namespace client_util {
-typedef int (*DLL_MAIN)(HINSTANCE instance, sandbox::SandboxInterfaceInfo*,
- TCHAR*);
-
-extern const wchar_t kProductVersionKey[];
-
-// Returns true if file specified by file_path exists
-bool FileExists(const std::wstring& file_path);
-
-// Returns Chromium version after reading it from reg_key registry key. Uses
-// exe_path to detemine registry root key (HKLM/HKCU). Note it is the
-// responsibility of caller to free *version when function is successful.
-bool GetChromiumVersion(const wchar_t* const exe_path,
- const wchar_t* const reg_key_path,
- wchar_t** version);
-
-// Get path to DLL specified by dll_name. If dll_path is specified and it
-// exists we assume DLL is in that directory and return that. Else we search
-// for that DLL by calling Windows API.
-std::wstring GetDLLPath(const std::wstring& dll_name,
- const std::wstring& dll_path);
-
-// Returns the path to the exe (without the file name) that called this
-// function.
-std::wstring GetExecutablePath();
-
-} // namespace client_util
+namespace sandbox {
+ union SandboxInterfaceInfo;
+}
+
+// Implements the common aspects of loading chrome.dll for both chrome and
+// chromium scenarios, which are in charge of implementing two abstract
+// methods: GetRegistryPath() and OnBeforeLaunch().
+class MainDllLoader {
+ public:
+ MainDllLoader();
+ virtual ~MainDllLoader();
+
+ // Loads and calls the entry point of chrome.dll. |instance| is the exe
+ // instance retrieved from wWinMain and the |sbox_info| is the broker or
+ // target services interface pointer.
+ // The return value is what the main entry point of chrome.dll returns
+ // upon termination.
+ int Launch(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sbox_info);
+
+ // Derived classes must return the relative registry path that holds the
+ // most current version of chrome.dll.
+ virtual std::wstring GetRegistryPath() = 0;
+
+ // Called after chrome.dll has beem loaded but before the entry point
+ // is invoked. Derived classes can implement custom actions here.
+ virtual void OnBeforeLaunch(const std::wstring& version) {}
+
+ protected:
+ HMODULE Load(std::wstring* version, std::wstring* file);
+
+ private:
+ // Chrome.dll handle.
+ HMODULE dll_;
+};
+
+// Factory for the MainDllLoader. Caller owns the pointer and should call
+// delete to free it.
+MainDllLoader* MakeMainDllLoader();
#endif // CHROME_APP_CLIENT_UTIL_H_