|
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2010 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_FRAME_READY_MODE_INTERNAL_REGISTRY_READY_MODE_STATE_H_ | |
6 #define CHROME_FRAME_READY_MODE_INTERNAL_REGISTRY_READY_MODE_STATE_H_ | |
7 | |
grt (UTC plus 2)
2010/12/11 03:12:06
#pragma once
erikwright (departed)
2010/12/14 16:15:17
Done.
| |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/scoped_ptr.h" | |
12 #include "base/time.h" | |
13 #include "chrome_frame/ready_mode/internal/ready_mode_state.h" | |
14 | |
15 enum ReadyModeStatus; | |
16 | |
17 class InstallationState; | |
18 class Task; | |
19 | |
20 // Implements ReadyModeState, storing state in the Registry and delegating to an | |
21 // instance of InstallationState to interact with the isntaller. Notifies a | |
grt (UTC plus 2)
2010/12/11 03:12:06
isntaller -> installer
erikwright (departed)
2010/12/14 16:15:17
Done.
| |
22 // single Observer when the state changes. | |
23 class RegistryReadyModeState : public ReadyModeState { | |
24 public: | |
25 // Receives notification when the Ready Mode state changes in response to a | |
26 // user interaction. Does not receive notification when a temporary decline of | |
27 // Ready Mode expires. | |
28 class Observer { | |
29 public: | |
30 virtual ~Observer() {} | |
31 // Indicates that a state change has occurred. | |
32 virtual void OnStateChange() = 0; | |
33 }; // class Observer | |
34 | |
35 // Construct an instance backed by the specified key | |
36 // (pre-existing under HKCU). The provided duration indicates how long, after | |
37 // a temporary decline, Ready Mode re-activates. | |
38 // | |
39 // Takes ownership of the Observer and InstallationState instances. | |
40 RegistryReadyModeState(const std::wstring& key_name, | |
41 base::TimeDelta temporary_decline_duration, | |
42 InstallationState* installation_state, | |
43 Observer* observer); | |
44 virtual ~RegistryReadyModeState(); | |
45 | |
46 // Returns the current Ready Mode status, as determined using our registry | |
47 // state and InstallationState instance. | |
48 ReadyModeStatus GetStatus(); | |
49 | |
50 // ReadyModeState implementation | |
51 virtual void TemporarilyDeclineChromeFrame(); | |
52 virtual void PermanentlyDeclineChromeFrame(); | |
53 virtual void AcceptChromeFrame(); | |
54 | |
55 protected: | |
56 // allow dependency replacement via derivation for tests | |
57 virtual base::Time GetNow(); | |
58 | |
59 private: | |
60 // Retrieves state from the registry. Returns true upon success. | |
61 bool GetValue(int64* value, bool* exists); | |
62 // Stores value in the registry. Returns true upon success. | |
63 bool StoreValue(int64 value); | |
64 | |
65 base::TimeDelta temporary_decline_duration_; | |
66 int temporary_decline_length_seconds_; | |
67 std::wstring key_name_; | |
68 scoped_ptr<InstallationState> installation_state_; | |
69 scoped_ptr<Observer> observer_; | |
70 }; | |
grt (UTC plus 2)
2010/12/11 03:12:06
}; // class RegistryReadyModeState
erikwright (departed)
2010/12/14 16:15:17
Done.
| |
71 | |
72 #endif // CHROME_FRAME_READY_MODE_INTERNAL_REGISTRY_READY_MODE_STATE_H_ | |
OLD | NEW |