summaryrefslogtreecommitdiffstats
path: root/ceee/ie/common/ceee_module_util.h
blob: e7b2f300505c354b58e4a0fcc17487770d04254b (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Copyright (c) 2010 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.
//
// CEEE module-wide utilities.

#ifndef CEEE_IE_COMMON_TOOLBAND_MODULE_UTIL_H__
#define CEEE_IE_COMMON_TOOLBAND_MODULE_UTIL_H__

#include <wtypes.h>
#include <string>

#include "base/file_path.h"
#include "base/time.h"

namespace ceee_module_util {

void AddRefModuleWorkerThread();
void ReleaseModuleWorkerThread();

// Fires an event to the broker, so that the call can be made with an
// instance of a broker proxy that was CoCreated in the worker thread.
void FireEventToBroker(const std::string& event_name,
                       const std::string& event_args);

void Lock();
void Unlock();

LONG LockModule();
LONG UnlockModule();

class AutoLock {
 public:
  AutoLock() {
    Lock();
  }
  ~AutoLock() {
    Unlock();
  }
};

// Gets the path of a .crx that should be installed at the same time as
// CEEE is installed.  May be empty, meaning no .crx files need to be
// installed.
//
// If the returned path does not have a .crx extension, it should be
// assumed to be an exploded extension directory rather than a .crx
std::wstring GetExtensionPath();

// Return the path and time of the last installation that occurred.
FilePath GetInstalledExtensionPath();
base::Time GetInstalledExtensionTime();

// Return true if the extension is outdated compared to the registry
bool NeedToInstallExtension();

// Install an extension and sets the right registry values
void SetInstalledExtensionPath(const FilePath& path);

// Returns true if the given path ends with .crx or is empty (as an
// unset "what to load/install" preference means we should expect
// an extension to already be installed).
bool IsCrxOrEmpty(const std::wstring& path);

// Stores/reads a registry entry that tracks whether the user has made the
// toolband visible or hidden.
void SetOptionToolbandIsHidden(bool isHidden);
bool GetOptionToolbandIsHidden();

// Stores/reads a registry entry that tracks whether intial (after setup)
// positioning of the toolband has been completed.
void SetOptionToolbandForceReposition(bool reposition_next_time);
bool GetOptionToolbandForceReposition();

// Indicates whether ShowDW calls should affect registry tracking of the
// user's visibility preference.
void SetIgnoreShowDWChanges(bool ignore);
bool GetIgnoreShowDWChanges();

// Chooses between kChromeProfileName and kChromeProfileNameForAdmin depending
// on process properties (run as admin or not).
const wchar_t* GetBrokerProfileNameForIe();

// Returns true if Chrome Frame is allowed to send usage stats.
bool GetCollectStatsConsent();

// Returns Google Update ClientState registry key for ChromeFrame.
std::wstring GetCromeFrameClientStateKey();

// The name of the profile that is used by the Firefox CEEE.
extern const wchar_t kChromeProfileNameForFirefox[];

// The name of the Internet Explorer executable.
extern const wchar_t kInternetExplorerModuleName[];

// The name of the CEEE Broker executable.
extern const wchar_t kCeeeBrokerModuleName[];

}  // namespace

#endif  // CEEE_IE_COMMON_TOOLBAND_MODULE_UTIL_H__