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

Side by Side Diff: chrome/browser/importer/ie_importer_test_registry_overrider_win.h

Issue 14143010: Introduce IEImporterTestRegistryOverrider to be able to override the registry for a test and flag t… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: grammar Created 7 years, 7 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 #ifndef CHROME_BROWSER_IMPORTER_IE_IMPORTER_TEST_REGISTRY_OVERRIDER_WIN_H_
6 #define CHROME_BROWSER_IMPORTER_IE_IMPORTER_TEST_REGISTRY_OVERRIDER_WIN_H_
7
8 #include "base/basictypes.h"
9
10 // A helper class to override HKEY_CURRENT_USER to point to a test key from this
11 // process' point of view. Also provides functionality (via an environment
12 // variable) to let child processes check whether they should also override.
13 // Always unsets any existing override upon being deleted.
14 class IEImporterTestRegistryOverrider {
15 public:
16 IEImporterTestRegistryOverrider() : override_set_by_current_process_(false) {}
17
18 // Unsets any existing registry override and deletes the temporary registry
19 // key if |override_set_by_current_process_|.
20 ~IEImporterTestRegistryOverrider();
21
22 // Calls StartRegistryOverride() and sets an environment variable so that
23 // future calls to StartRegistryOverrideIfNeeded() from child processes also
24 // result in an overriden registry.
25 // Returns false on unexpected failure.
26 bool SetRegistryOverride();
robertshield 2013/04/26 19:20:53 If I am reading this correctly, a caller should ne
gab 2013/04/29 02:00:43 Changed the interface quite a bit, let me know if
27
28 // Calls StartRegistryOverride() if the environment was set by a parent
29 // process via SetRegistryOverride().
30 // Returns false on unexpected failure.
31 bool StartRegistryOverrideIfNeeded();
32
33 private:
34 // Overrides HKCU to point to a test key from this process' point of view.
35 // Returns false on unexpected failure.
36 bool StartRegistryOverride();
37
38 // Whether a registry override was initiated in the current process.
39 bool override_active_;
robertshield 2013/04/26 19:20:53 should this be static?
gab 2013/04/29 02:00:43 See main comment.
40
41 // Wheter this process is the one that set the override (and thus should be
robertshield 2013/04/26 19:20:53 nit: Whether
gab 2013/04/29 02:00:43 Done.
42 // the one deleting the temporary key when done).
43 bool override_set_by_current_process_;
44
45 DISALLOW_COPY_AND_ASSIGN(IEImporterTestRegistryOverrider);
46 };
47
48 #endif // CHROME_BROWSER_IMPORTER_IE_IMPORTER_TEST_REGISTRY_OVERRIDER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698