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

Side by Side Diff: chrome_frame/turndown_prompt/reshow_state.cc

Issue 17153006: Chrome Frame turndown prompt. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: robert comments Created 7 years, 6 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 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 #include "chrome_frame/turndown_prompt/reshow_state.h"
6
7 #include "base/win/registry.h"
8 #include "chrome_frame/utils.h"
9
10 namespace {
11
12 const wchar_t kTurndownPromptLastShown[] = L"TurndownPromptLastShown";
13
14 }
15
16 namespace turndown_prompt {
17
18 ReshowState::ReshowState(const string16& key_path,
19 const base::TimeDelta& reshow_delta)
20 : key_path_(key_path),
21 reshow_delta_(reshow_delta) {
22 }
23
24 ReshowState::~ReshowState() {
25 }
26
27 bool ReshowState::HasReshowDeltaExpired(const base::Time& current_time) const {
28 int64 last_shown = GetConfigInt64(0LL, kTurndownPromptLastShown);
29 if (!last_shown)
30 return true;
31
32 base::Time last_shown_time(base::Time::FromInternalValue(last_shown));
33
34 return current_time - last_shown_time >= reshow_delta_;
35 }
36
37 void ReshowState::MarkShown(const base::Time& last_shown_time) {
38 SetConfigInt64(kTurndownPromptLastShown, last_shown_time.ToInternalValue());
39 }
40
41 } // namespace turndown_prompt
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698