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

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

Issue 1402353011: Expose a function to get the path to a DLL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: grt comment #17 (pass StringPiece16 by value) Created 5 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
« no previous file with comments | « chrome/app/chrome_exe_main_win.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
(Empty)
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.
4
5 // This file defines utility functions that can report details about the
6 // host operating environment.
7
8 #ifndef CHROME_APP_CLIENT_UTIL_H_
9 #define CHROME_APP_CLIENT_UTIL_H_
10
11 #include <windows.h>
12
13 #include <string>
14 #include "base/strings/string16.h"
15
16 namespace sandbox {
17 struct SandboxInterfaceInfo;
18 }
19
20 // Returns the version in the current module's version resource or the empty
21 // string if none found.
22 base::string16 GetCurrentModuleVersion();
23
24 // Implements the common aspects of loading the main dll for both chrome and
25 // chromium scenarios, which are in charge of implementing two abstract
26 // methods: GetRegistryPath() and OnBeforeLaunch().
27 class MainDllLoader {
28 public:
29 MainDllLoader();
30 virtual ~MainDllLoader();
31
32 // Loads and calls the entry point of chrome.dll. |instance| is the exe
33 // instance retrieved from wWinMain.
34 // The return value is what the main entry point of chrome.dll returns
35 // upon termination.
36 int Launch(HINSTANCE instance);
37
38 // Launches a new instance of the browser if the current instance in
39 // persistent mode an upgrade is detected.
40 void RelaunchChromeBrowserWithNewCommandLineIfNeeded();
41
42 protected:
43 // Called after chrome.dll has been loaded but before the entry point
44 // is invoked. Derived classes can implement custom actions here.
45 // |process_type| is the argument to the --type command line argument, e.g.
46 // "renderer", "watcher", etc.
47 // |dll_path| refers to the path of the Chrome dll being loaded.
48 virtual void OnBeforeLaunch(const std::string& process_type,
49 const base::FilePath& dll_path) = 0;
50
51 // Called after the chrome.dll entry point returns and before terminating
52 // this process. The return value will be used as the process return code.
53 // |dll_path| refers to the path of the Chrome dll being loaded.
54 virtual int OnBeforeExit(int return_code, const base::FilePath& dll_path) = 0;
55
56 private:
57 // Loads chrome.dll, populating |version| with the version of the DLL loaded
58 // and |module| with the path of the loaded DLL. Returns a reference to the
59 // module, or null on failure.
60 HMODULE Load(base::string16* version, base::FilePath* module);
61
62 private:
63 HMODULE dll_;
64 std::string process_type_;
65 const bool metro_mode_;
66 };
67
68 // Factory for the MainDllLoader. Caller owns the pointer and should call
69 // delete to free it.
70 MainDllLoader* MakeMainDllLoader();
71
72 #endif // CHROME_APP_CLIENT_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/app/chrome_exe_main_win.cc ('k') | chrome/app/client_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698