summaryrefslogtreecommitdiffstats
path: root/chrome_frame/ready_mode/internal
diff options
context:
space:
mode:
authorerikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 18:28:00 +0000
committererikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 18:28:00 +0000
commitd43e631b9ccc4fcf9eee0813f4f4e342169d455d (patch)
tree6c2afc3caccf2dc6ef623d716b9c54fb7ba509aa /chrome_frame/ready_mode/internal
parent679d965b4292d028e68591c2d0d2b84e23eed005 (diff)
downloadchromium_src-d43e631b9ccc4fcf9eee0813f4f4e342169d455d.zip
chromium_src-d43e631b9ccc4fcf9eee0813f4f4e342169d455d.tar.gz
chromium_src-d43e631b9ccc4fcf9eee0813f4f4e342169d455d.tar.bz2
C++ Readability CL for erikwright.
Ready Mode is a feature of Chrome Frame that allows it to be installed in a semi-active state. The first time the user accesses, using IE, a site that supports Chrome Frame, the Ready Mode infobar prompt is displayed in IE, offering to permanently enable or disable Chrome Frame. RegistryReadyModeState implements a strategy for implementing the user's requested state change by invoking the Chrome Frame installer. BUG=None TEST=None Review URL: http://codereview.chromium.org/6733015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/ready_mode/internal')
-rw-r--r--chrome_frame/ready_mode/internal/registry_ready_mode_state.cc4
-rw-r--r--chrome_frame/ready_mode/internal/registry_ready_mode_state.h31
2 files changed, 22 insertions, 13 deletions
diff --git a/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc b/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
index 94d7a1b..70a2df4 100644
--- a/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
+++ b/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
@@ -158,7 +158,7 @@ ReadyModeStatus RegistryReadyModeState::GetStatus() {
bool exists = false;
int64 value = 0;
- if (!GetValue(&value, &exists))
+ if (!GetStateFromRegistry(&value, &exists))
return READY_MODE_ACTIVE;
if (!exists)
@@ -189,7 +189,7 @@ void RegistryReadyModeState::NotifyObserver() {
observer_->OnStateChange(GetStatus());
}
-bool RegistryReadyModeState::GetValue(int64* value, bool* exists) {
+bool RegistryReadyModeState::GetStateFromRegistry(int64* value, bool* exists) {
*exists = false;
*value = 0;
diff --git a/chrome_frame/ready_mode/internal/registry_ready_mode_state.h b/chrome_frame/ready_mode/internal/registry_ready_mode_state.h
index b460d01..87076d9 100644
--- a/chrome_frame/ready_mode/internal/registry_ready_mode_state.h
+++ b/chrome_frame/ready_mode/internal/registry_ready_mode_state.h
@@ -13,19 +13,28 @@
#include "base/time.h"
#include "chrome_frame/ready_mode/internal/ready_mode_state.h"
-class InstallationState;
-class Task;
-
+// Defines the possible Ready Mode states.
enum ReadyModeStatus {
+ // Chrome Frame is permanently disabled and should be uninstalled.
READY_MODE_PERMANENTLY_DECLINED,
+ // Chrome Frame is temporarily disabled.
READY_MODE_TEMPORARILY_DECLINED,
+ // Chrome Frame is disabled, but should be enabled by calling
+ // ExpireTemporaryDecline().
READY_MODE_TEMPORARY_DECLINE_EXPIRED,
+ // Chrome Frame is enabled, but not permanently (the user should be prompted).
READY_MODE_ACTIVE,
+ // Chrome Frame is permanently enabled.
READY_MODE_ACCEPTED
-}; // enum ReadyModeStatus
+};
-// Implements ReadyModeState, reading state from the Registry and delegating to
-// an elevated process launcher to effect state changes.
+// Implements ReadyModeState, reading state from the Registry and delegating
+// to the installer to effect state changes.
+//
+// If the current process is running at high integrity the installer is
+// launched directly. Otherwise, it is launched by invoking a helper exe
+// (chrome_launcher) at medium integrity (thanks to an elevation policy) that,
+// in turn, delegates to Omaha's ProcessLauncher to reach high integrity.
class RegistryReadyModeState : public ReadyModeState {
public:
// Receives notification when the Ready Mode state changes in response to a
@@ -36,9 +45,9 @@ class RegistryReadyModeState : public ReadyModeState {
virtual ~Observer() {}
// Indicates that a state change has occurred, passing the new status.
virtual void OnStateChange(ReadyModeStatus status) = 0;
- }; // class Observer
+ };
- // Construct an instance backed by the specified key (pre-existing under
+ // Constructs an instance backed by the specified key (pre-existing under
// HKCU or HKLM). The provided duration indicates how long, after a temporary
// decline, Ready Mode re-activates.
//
@@ -61,14 +70,14 @@ class RegistryReadyModeState : public ReadyModeState {
virtual void AcceptChromeFrame();
protected:
- // allow dependency replacement via derivation for tests
+ // Allows dependency replacement via derivation for tests.
virtual base::Time GetNow();
private:
// Sends the result of GetStatus() to our observer.
void NotifyObserver();
// Retrieves state from the registry. Returns true upon success.
- bool GetValue(int64* value, bool* exists);
+ bool GetStateFromRegistry(int64* value, bool* exists);
// Refreshes the process state after mutating installation state.
void RefreshStateAndNotify();
@@ -77,6 +86,6 @@ class RegistryReadyModeState : public ReadyModeState {
scoped_ptr<Observer> observer_;
DISALLOW_COPY_AND_ASSIGN(RegistryReadyModeState);
-}; // class RegistryReadyModeState
+};
#endif // CHROME_FRAME_READY_MODE_INTERNAL_REGISTRY_READY_MODE_STATE_H_