OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 // | |
5 // This is the Chrome-GoogleUpdater integration glue. Current features of this | |
6 // code include: | |
7 // * checks to ensure that client is properly registered with GoogleUpdater | |
8 // * versioned directory launcher to allow for completely transparent silent | |
9 // autoupdates | |
10 | |
11 | |
12 #ifndef CHROME_APP_GOOGLE_UPDATE_CLIENT_H_ | |
13 #define CHROME_APP_GOOGLE_UPDATE_CLIENT_H_ | |
14 | |
15 #include <windows.h> | |
16 #include <tchar.h> | |
17 | |
18 #include <string> | |
19 | |
20 #include "sandbox/src/sandbox_factory.h" | |
21 | |
22 namespace google_update { | |
23 | |
24 class GoogleUpdateClient { | |
25 public: | |
26 GoogleUpdateClient(); | |
27 virtual ~GoogleUpdateClient(); | |
28 | |
29 // Returns the full path of the DLL that is going to be loaded. | |
30 // This function can be called only after Init(). | |
31 std::wstring GetDLLFullPath(); | |
32 | |
33 // Returns the path containing the DLL that is going to be loaded. | |
34 // This function can be called only after Init(). | |
35 std::wstring GetDLLPath(); | |
36 | |
37 // For the client guid, returns the associated version string, or NULL | |
38 // if Init() was unable to obtain one. | |
39 const wchar_t* GetVersion() const; | |
40 | |
41 // Init must be called prior to other methods. | |
42 // client_guid is the guid that you registered with Google Update when you | |
43 // installed. | |
44 // Returns false if client is not properly registered with GoogleUpdate. If | |
45 // not registered, autoupdates won't be performed for this client. | |
46 bool Init(const wchar_t* client_guid, const wchar_t* client_dll); | |
47 | |
48 // Launches your app's main code and initializes Google Update services. | |
49 // - looks up the registered version via GoogleUpdate, loads dll from version | |
50 // dir (e.g. Program Files/Google/1.0.101.0/chrome.dll) and calls the | |
51 // entry_name. If chrome.dll is found in this path the version is stored | |
52 // in the environment block such that subsequent launches invoke the | |
53 // save dll version. | |
54 // - instance is handle to the current instance of application | |
55 // - sandbox provides information about sandbox services | |
56 // - command_line contains command line parameters | |
57 // - entry_name is the function of type DLL_MAIN that is called | |
58 // from chrome.dll | |
59 // - ret is an out param with the return value of entry | |
60 // Returns false if unable to load the dll or find entry_name's proc addr. | |
61 bool Launch(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sandbox, | |
62 wchar_t* command_line, const char* entry_name, int* ret); | |
63 | |
64 private: | |
65 // disallow copy ctor and operator= | |
66 GoogleUpdateClient(const GoogleUpdateClient&); | |
67 void operator=(const GoogleUpdateClient&); | |
68 | |
69 // The GUID that this client has registered with GoogleUpdate for autoupdate. | |
70 std::wstring guid_; | |
71 // The name of the dll to load. | |
72 std::wstring dll_; | |
73 // The current version of this client registered with GoogleUpdate. | |
74 wchar_t* version_; | |
75 // The location of current chrome.dll. | |
76 std::wstring dll_path_; | |
77 }; | |
78 | |
79 } // namespace google_update | |
80 | |
81 #endif // CHROME_APP_GOOGLE_UPDATE_CLIENT_H_ | |
OLD | NEW |