summaryrefslogtreecommitdiffstats
path: root/chrome/app/client_util.cc
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-12 18:07:18 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-12 18:07:18 +0000
commitfd59f820f28a384de8f880237979e7fe28854040 (patch)
tree73ac1a76e39be8e8788bf533d63c52c64b3c250a /chrome/app/client_util.cc
parenta6e02d0b9b0a1e89c990ac937c8ac81bd9bd9946 (diff)
downloadchromium_src-fd59f820f28a384de8f880237979e7fe28854040.zip
chromium_src-fd59f820f28a384de8f880237979e7fe28854040.tar.gz
chromium_src-fd59f820f28a384de8f880237979e7fe28854040.tar.bz2
Change the writting to the 'did run' registry to better account actives
Now we not just call it from chrome.exe (chrome/app) but it is also called periodically from chrome.dll itself BUG=82180 TEST=see bug Review URL: http://codereview.chromium.org/7005008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85152 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/client_util.cc')
-rw-r--r--chrome/app/client_util.cc47
1 files changed, 4 insertions, 43 deletions
diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc
index 55f3d8c..aa15181 100644
--- a/chrome/app/client_util.cc
+++ b/chrome/app/client_util.cc
@@ -23,6 +23,7 @@
#include "chrome/installer/util/channel_info.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/google_update_constants.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/util_constants.h"
#include "content/common/result_codes.h"
@@ -141,56 +142,16 @@ HMODULE LoadChromeWithDirectory(std::wstring* dir) {
LOAD_WITH_ALTERED_SEARCH_PATH);
}
-// Set did_run "dr" to |value| in Google Update's client state key for the
-// product associated with |dist|, creating the client state key if necessary.
-bool SetDidRunState(BrowserDistribution* dist, const wchar_t* value) {
- DCHECK(dist);
- DCHECK(value);
- bool wrote_dr = false;
- std::wstring product_key_path(dist->GetStateKey());
- base::win::RegKey reg_key;
- if (reg_key.Create(HKEY_CURRENT_USER, product_key_path.c_str(),
- KEY_SET_VALUE) == ERROR_SUCCESS) {
- if (reg_key.WriteValue(google_update::kRegDidRunField,
- value) == ERROR_SUCCESS) {
- wrote_dr = true;
- }
- }
- return wrote_dr;
-}
-
-
void RecordDidRun(const std::wstring& dll_path) {
- static const wchar_t kSet[] = L"1";
- BrowserDistribution* product_dist = BrowserDistribution::GetDistribution();
- SetDidRunState(product_dist, kSet);
-
- // If this is a multi-install, also write the did_run value under the
- // multi key.
bool system_level = !InstallUtil::IsPerUserInstall(dll_path.c_str());
- if (InstallUtil::IsMultiInstall(product_dist, system_level)) {
- BrowserDistribution* multi_dist =
- BrowserDistribution::GetSpecificDistribution(
- BrowserDistribution::CHROME_BINARIES);
- SetDidRunState(multi_dist, kSet);
- }
+ GoogleUpdateSettings::UpdateDidRunState(true, system_level);
}
void ClearDidRun(const std::wstring& dll_path) {
- static const wchar_t kCleared[] = L"0";
- BrowserDistribution* product_dist = BrowserDistribution::GetDistribution();
- SetDidRunState(product_dist, kCleared);
-
- // If this is a multi-install, also clear the did_run value under the
- // multi key.
bool system_level = !InstallUtil::IsPerUserInstall(dll_path.c_str());
- if (InstallUtil::IsMultiInstall(product_dist, system_level)) {
- BrowserDistribution* multi_dist =
- BrowserDistribution::GetSpecificDistribution(
- BrowserDistribution::CHROME_BINARIES);
- SetDidRunState(multi_dist, kCleared);
- }
+ GoogleUpdateSettings::UpdateDidRunState(false, system_level);
}
+
}
//=============================================================================