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

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

Issue 10825213: Cause chrome.exe to introspect to find the version of chrome.dll to load. This should ensure that m… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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 | « no previous file | 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) 2012 The Chromium Authors. All rights reserved. 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 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 #include <string> 12 #include <string>
gab 2012/08/07 03:34:11 nit: You no longer need to include string.
13 13
14 #include "base/string16.h"
15
14 namespace sandbox { 16 namespace sandbox {
15 struct SandboxInterfaceInfo; 17 struct SandboxInterfaceInfo;
16 } 18 }
17 19
18 // Gets the path of the current exe with a trailing backslash. 20 // Gets the path of the current exe with a trailing backslash.
19 std::wstring GetExecutablePath(); 21 string16 GetExecutablePath();
20 22
21 // Implements the common aspects of loading chrome.dll for both chrome and 23 // Implements the common aspects of loading chrome.dll for both chrome and
22 // chromium scenarios, which are in charge of implementing two abstract 24 // chromium scenarios, which are in charge of implementing two abstract
23 // methods: GetRegistryPath() and OnBeforeLaunch(). 25 // methods: GetRegistryPath() and OnBeforeLaunch().
24 class MainDllLoader { 26 class MainDllLoader {
25 public: 27 public:
26 MainDllLoader(); 28 MainDllLoader();
27 virtual ~MainDllLoader(); 29 virtual ~MainDllLoader();
28 30
29 // Loads and calls the entry point of chrome.dll. |instance| is the exe 31 // Loads and calls the entry point of chrome.dll. |instance| is the exe
30 // instance retrieved from wWinMain and the |sbox_info| is the broker or 32 // instance retrieved from wWinMain and the |sbox_info| is the broker or
31 // target services interface pointer. 33 // target services interface pointer.
32 // The return value is what the main entry point of chrome.dll returns 34 // The return value is what the main entry point of chrome.dll returns
33 // upon termination. 35 // upon termination.
34 int Launch(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sbox_info); 36 int Launch(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sbox_info);
35 37
36 // Look into the registry to find the latest version. 38 // Look into the registry to find the latest version.
37 std::wstring GetVersion(); 39 string16 GetVersion();
38 40
39 // Launches a new instance of the browser if the current instance in 41 // Launches a new instance of the browser if the current instance in
40 // persistent mode an upgrade is detected. 42 // persistent mode an upgrade is detected.
41 void RelaunchChromeBrowserWithNewCommandLineIfNeeded(); 43 void RelaunchChromeBrowserWithNewCommandLineIfNeeded();
42 44
43 // Called after chrome.dll has been loaded but before the entry point 45 // Called after chrome.dll has been loaded but before the entry point
44 // is invoked. Derived classes can implement custom actions here. 46 // is invoked. Derived classes can implement custom actions here.
45 // |dll_path| refers to the path of the Chrome dll being loaded. 47 // |dll_path| refers to the path of the Chrome dll being loaded.
46 virtual void OnBeforeLaunch(const std::wstring& dll_path) {} 48 virtual void OnBeforeLaunch(const string16& dll_path) {}
47 49
48 // Called after the chrome.dll entry point returns and before terminating 50 // Called after the chrome.dll entry point returns and before terminating
49 // this process. The return value will be used as the process return code. 51 // this process. The return value will be used as the process return code.
50 // |dll_path| refers to the path of the Chrome dll being loaded. 52 // |dll_path| refers to the path of the Chrome dll being loaded.
51 virtual int OnBeforeExit(int return_code, const std::wstring& dll_path) { 53 virtual int OnBeforeExit(int return_code, const string16& dll_path) {
52 return return_code; 54 return return_code;
53 } 55 }
54 56
55 protected: 57 protected:
56 // Derived classes must return the relative registry path that holds the 58 // Derived classes must return the relative registry path that holds the
57 // most current version of chrome.dll. 59 // most current version of chrome.dll.
58 virtual std::wstring GetRegistryPath() = 0; 60 virtual string16 GetRegistryPath() = 0;
59 61
60 HMODULE Load(std::wstring* out_version, std::wstring* out_file); 62 HMODULE Load(string16* out_version, string16* out_file);
61 63
62 private: 64 private:
63 // Chrome.dll handle. 65 // Chrome.dll handle.
64 HMODULE dll_; 66 HMODULE dll_;
65 }; 67 };
66 68
67 // Factory for the MainDllLoader. Caller owns the pointer and should call 69 // Factory for the MainDllLoader. Caller owns the pointer and should call
68 // delete to free it. 70 // delete to free it.
69 MainDllLoader* MakeMainDllLoader(); 71 MainDllLoader* MakeMainDllLoader();
70 72
71 #endif // CHROME_APP_CLIENT_UTIL_H_ 73 #endif // CHROME_APP_CLIENT_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/app/client_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698