summaryrefslogtreecommitdiffstats
path: root/chrome/app/google_update_client.h
blob: 7d063f3633950d305fcda6fb4cc47e774c289120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This is the Chrome-GoogleUpdater integration glue. Current features of this
// code include:
// * checks to ensure that client is properly registered with GoogleUpdater
// * versioned directory launcher to allow for completely transparent silent
//   autoupdates


#ifndef CHROME_APP_GOOGLE_UPDATE_CLIENT_H_
#define CHROME_APP_GOOGLE_UPDATE_CLIENT_H_

#include <windows.h>
#include <tchar.h>

#include <string>

#include "sandbox/src/sandbox_factory.h"

namespace google_update {

class GoogleUpdateClient {
 public:
  GoogleUpdateClient();
  virtual ~GoogleUpdateClient();

  // Returns the full path of the DLL that is going to be loaded.
  // This function can be called only after Init().
  std::wstring GetDLLFullPath();

  // Returns the path containing the DLL that is going to be loaded.
  // This function can be called only after Init().
  std::wstring GetDLLPath();

  // For the client guid, returns the associated version string, or NULL
  // if Init() was unable to obtain one.
  const wchar_t* GetVersion() const;

  // Init must be called prior to other methods.
  // client_guid is the guid that you registered with Google Update when you
  // installed.
  // Returns false if client is not properly registered with GoogleUpdate.  If
  // not registered, autoupdates won't be performed for this client.
  bool Init(const wchar_t* client_guid, const wchar_t* client_dll);

  // Launches your app's main code and initializes Google Update services.
  // - looks up the registered version via GoogleUpdate, loads dll from version
  //   dir (e.g. Program Files/Google/1.0.101.0/chrome.dll) and calls the
  //   entry_name. If chrome.dll is found in this path the version is stored
  //   in the environment block such that subsequent launches invoke the
  //   save dll version.
  // - instance is handle to the current instance of application
  // - sandbox provides information about sandbox services
  // - command_line contains command line parameters
  // - entry_name is the function of type DLL_MAIN that is called
  //   from chrome.dll
  // - ret is an out param with the return value of entry
  // Returns false if unable to load the dll or find entry_name's proc addr.
  bool Launch(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sandbox,
              wchar_t* command_line, const char* entry_name, int* ret);

 private:
  // disallow copy ctor and operator=
  GoogleUpdateClient(const GoogleUpdateClient&);
  void operator=(const GoogleUpdateClient&);

  // The GUID that this client has registered with GoogleUpdate for autoupdate.
  std::wstring guid_;
  // The name of the dll to load.
  std::wstring dll_;
  // The current version of this client registered with GoogleUpdate.
  wchar_t* version_;
  // The location of current chrome.dll.
  wchar_t dll_path_[MAX_PATH];
};

}  // namespace google_update

#endif  // CHROME_APP_GOOGLE_UPDATE_CLIENT_H_