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

Side by Side Diff: chrome/app/client_util.h

Issue 345036: Rewrite of chrome.exe startup code... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | « chrome/app/chrome_exe_main.cc ('k') | chrome/app/client_util.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This file defines utility functions that can report details about the 5 // This file defines utility functions that can report details about the
6 // host operating environment. 6 // host operating environment.
7 7
8 #ifndef CHROME_APP_CLIENT_UTIL_H_ 8 #ifndef CHROME_APP_CLIENT_UTIL_H_
9 #define CHROME_APP_CLIENT_UTIL_H_ 9 #define CHROME_APP_CLIENT_UTIL_H_
10 10
11 #include <windows.h> 11 #include <windows.h>
12
13 #include <string> 12 #include <string>
14 13
15 #include "sandbox/src/sandbox_factory.h" 14 namespace sandbox {
15 union SandboxInterfaceInfo;
16 }
16 17
17 namespace client_util { 18 // Implements the common aspects of loading chrome.dll for both chrome and
18 typedef int (*DLL_MAIN)(HINSTANCE instance, sandbox::SandboxInterfaceInfo*, 19 // chromium scenarios, which are in charge of implementing two abstract
19 TCHAR*); 20 // methods: GetRegistryPath() and OnBeforeLaunch().
21 class MainDllLoader {
22 public:
23 MainDllLoader();
24 virtual ~MainDllLoader();
20 25
21 extern const wchar_t kProductVersionKey[]; 26 // Loads and calls the entry point of chrome.dll. |instance| is the exe
27 // instance retrieved from wWinMain and the |sbox_info| is the broker or
28 // target services interface pointer.
29 // The return value is what the main entry point of chrome.dll returns
30 // upon termination.
31 int Launch(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sbox_info);
22 32
23 // Returns true if file specified by file_path exists 33 // Derived classes must return the relative registry path that holds the
24 bool FileExists(const std::wstring& file_path); 34 // most current version of chrome.dll.
35 virtual std::wstring GetRegistryPath() = 0;
25 36
26 // Returns Chromium version after reading it from reg_key registry key. Uses 37 // Called after chrome.dll has beem loaded but before the entry point
27 // exe_path to detemine registry root key (HKLM/HKCU). Note it is the 38 // is invoked. Derived classes can implement custom actions here.
28 // responsibility of caller to free *version when function is successful. 39 virtual void OnBeforeLaunch(const std::wstring& version) {}
29 bool GetChromiumVersion(const wchar_t* const exe_path,
30 const wchar_t* const reg_key_path,
31 wchar_t** version);
32 40
33 // Get path to DLL specified by dll_name. If dll_path is specified and it 41 protected:
34 // exists we assume DLL is in that directory and return that. Else we search 42 HMODULE Load(std::wstring* version, std::wstring* file);
35 // for that DLL by calling Windows API.
36 std::wstring GetDLLPath(const std::wstring& dll_name,
37 const std::wstring& dll_path);
38 43
39 // Returns the path to the exe (without the file name) that called this 44 private:
40 // function. 45 // Chrome.dll handle.
41 std::wstring GetExecutablePath(); 46 HMODULE dll_;
47 };
42 48
43 } // namespace client_util 49 // Factory for the MainDllLoader. Caller owns the pointer and should call
50 // delete to free it.
51 MainDllLoader* MakeMainDllLoader();
44 52
45 #endif // CHROME_APP_CLIENT_UTIL_H_ 53 #endif // CHROME_APP_CLIENT_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/app/chrome_exe_main.cc ('k') | chrome/app/client_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698