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

Side by Side Diff: chrome_frame/ready_mode/internal/registry_ready_mode_state.h

Issue 5747002: Implement a ReadyPromptContent that displays a prompt to accept, temporarily ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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 #pragma once
8
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/scoped_ptr.h"
13 #include "base/time.h"
14 #include "chrome_frame/ready_mode/internal/ready_mode_state.h"
15
16 enum ReadyModeStatus;
17
18 class InstallationState;
19 class Task;
20
21 // Implements ReadyModeState, storing state in the Registry and delegating to an
22 // instance of InstallationState to interact with the installer. Notifies a
23 // single Observer when the state changes.
24 class RegistryReadyModeState : public ReadyModeState {
25 public:
26 // Receives notification when the Ready Mode state changes in response to a
27 // user interaction. Does not receive notification when a temporary decline of
28 // Ready Mode expires.
29 class Observer {
30 public:
31 virtual ~Observer() {}
32 // Indicates that a state change has occurred.
33 virtual void OnStateChange() = 0;
34 }; // class Observer
35
36 // Construct an instance backed by the specified key
37 // (pre-existing under HKCU). The provided duration indicates how long, after
38 // a temporary decline, Ready Mode re-activates.
39 //
40 // Takes ownership of the Observer and InstallationState instances.
41 RegistryReadyModeState(const std::wstring& key_name,
42 base::TimeDelta temporary_decline_duration,
43 InstallationState* installation_state,
44 Observer* observer);
45 virtual ~RegistryReadyModeState();
46
47 // Returns the current Ready Mode status, as determined using our registry
48 // state and InstallationState instance.
49 ReadyModeStatus GetStatus();
50
51 // ReadyModeState implementation
52 virtual void TemporarilyDeclineChromeFrame();
53 virtual void PermanentlyDeclineChromeFrame();
54 virtual void AcceptChromeFrame();
55
56 protected:
57 // allow dependency replacement via derivation for tests
58 virtual base::Time GetNow();
59
60 private:
61 // Retrieves state from the registry. Returns true upon success.
62 bool GetValue(int64* value, bool* exists);
63 // Stores value in the registry. Returns true upon success.
64 bool StoreValue(int64 value);
65
66 base::TimeDelta temporary_decline_duration_;
67 int temporary_decline_length_seconds_;
68 std::wstring key_name_;
69 scoped_ptr<InstallationState> installation_state_;
70 scoped_ptr<Observer> observer_;
71 }; // class RegistryReadyModeState
72
73 #endif // CHROME_FRAME_READY_MODE_INTERNAL_REGISTRY_READY_MODE_STATE_H_
OLDNEW
« no previous file with comments | « chrome_frame/ready_mode/internal/ready_prompt_window.cc ('k') | chrome_frame/ready_mode/internal/registry_ready_mode_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698