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

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: Remove unneeded header. 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
13 #include "base/string16.h"
13 14
14 namespace sandbox { 15 namespace sandbox {
15 struct SandboxInterfaceInfo; 16 struct SandboxInterfaceInfo;
16 } 17 }
17 18
18 // Gets the path of the current exe with a trailing backslash. 19 // Gets the path of the current exe with a trailing backslash.
19 std::wstring GetExecutablePath(); 20 string16 GetExecutablePath();
20 21
21 // Implements the common aspects of loading chrome.dll for both chrome and 22 // Implements the common aspects of loading chrome.dll for both chrome and
22 // chromium scenarios, which are in charge of implementing two abstract 23 // chromium scenarios, which are in charge of implementing two abstract
23 // methods: GetRegistryPath() and OnBeforeLaunch(). 24 // methods: GetRegistryPath() and OnBeforeLaunch().
24 class MainDllLoader { 25 class MainDllLoader {
25 public: 26 public:
26 MainDllLoader(); 27 MainDllLoader();
27 virtual ~MainDllLoader(); 28 virtual ~MainDllLoader();
28 29
29 // Loads and calls the entry point of chrome.dll. |instance| is the exe 30 // 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 31 // instance retrieved from wWinMain and the |sbox_info| is the broker or
31 // target services interface pointer. 32 // target services interface pointer.
32 // The return value is what the main entry point of chrome.dll returns 33 // The return value is what the main entry point of chrome.dll returns
33 // upon termination. 34 // upon termination.
34 int Launch(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sbox_info); 35 int Launch(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sbox_info);
35 36
36 // Look into the registry to find the latest version. 37 // Look into the registry to find the latest version.
37 std::wstring GetVersion(); 38 string16 GetVersion();
38 39
39 // Launches a new instance of the browser if the current instance in 40 // Launches a new instance of the browser if the current instance in
40 // persistent mode an upgrade is detected. 41 // persistent mode an upgrade is detected.
41 void RelaunchChromeBrowserWithNewCommandLineIfNeeded(); 42 void RelaunchChromeBrowserWithNewCommandLineIfNeeded();
42 43
43 // Called after chrome.dll has been loaded but before the entry point 44 // Called after chrome.dll has been loaded but before the entry point
44 // is invoked. Derived classes can implement custom actions here. 45 // is invoked. Derived classes can implement custom actions here.
45 // |dll_path| refers to the path of the Chrome dll being loaded. 46 // |dll_path| refers to the path of the Chrome dll being loaded.
46 virtual void OnBeforeLaunch(const std::wstring& dll_path) {} 47 virtual void OnBeforeLaunch(const string16& dll_path) {}
47 48
48 // Called after the chrome.dll entry point returns and before terminating 49 // 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. 50 // 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. 51 // |dll_path| refers to the path of the Chrome dll being loaded.
51 virtual int OnBeforeExit(int return_code, const std::wstring& dll_path) { 52 virtual int OnBeforeExit(int return_code, const string16& dll_path) {
52 return return_code; 53 return return_code;
53 } 54 }
54 55
55 protected: 56 protected:
56 // Derived classes must return the relative registry path that holds the 57 // Derived classes must return the relative registry path that holds the
57 // most current version of chrome.dll. 58 // most current version of chrome.dll.
58 virtual std::wstring GetRegistryPath() = 0; 59 virtual string16 GetRegistryPath() = 0;
59 60
60 HMODULE Load(std::wstring* out_version, std::wstring* out_file); 61 HMODULE Load(string16* out_version, string16* out_file);
61 62
62 private: 63 private:
63 // Chrome.dll handle. 64 // Chrome.dll handle.
64 HMODULE dll_; 65 HMODULE dll_;
65 }; 66 };
66 67
67 // Factory for the MainDllLoader. Caller owns the pointer and should call 68 // Factory for the MainDllLoader. Caller owns the pointer and should call
68 // delete to free it. 69 // delete to free it.
69 MainDllLoader* MakeMainDllLoader(); 70 MainDllLoader* MakeMainDllLoader();
70 71
71 #endif // CHROME_APP_CLIENT_UTIL_H_ 72 #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