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

Unified 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: rebase to r208076 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_frame/turndown_prompt/reshow_state.h ('k') | chrome_frame/turndown_prompt/turndown_prompt.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/turndown_prompt/reshow_state.cc
diff --git a/chrome_frame/turndown_prompt/reshow_state.cc b/chrome_frame/turndown_prompt/reshow_state.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cf7e2f9cbbaefff5c59650a7a628639837c03085
--- /dev/null
+++ b/chrome_frame/turndown_prompt/reshow_state.cc
@@ -0,0 +1,39 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome_frame/turndown_prompt/reshow_state.h"
+
+#include "base/win/registry.h"
+#include "chrome_frame/utils.h"
+
+namespace {
+
+const wchar_t kTurndownPromptLastShown[] = L"TurndownPromptLastShown";
+
+}
+
+namespace turndown_prompt {
+
+ReshowState::ReshowState(const base::TimeDelta& reshow_delta)
+ : reshow_delta_(reshow_delta) {
+}
+
+ReshowState::~ReshowState() {
+}
+
+bool ReshowState::HasReshowDeltaExpired(const base::Time& current_time) const {
+ int64 last_shown = GetConfigInt64(0LL, kTurndownPromptLastShown);
+ if (!last_shown)
+ return true;
+
+ base::Time last_shown_time(base::Time::FromInternalValue(last_shown));
+
+ return current_time - last_shown_time >= reshow_delta_;
+}
+
+void ReshowState::MarkShown(const base::Time& last_shown_time) {
+ SetConfigInt64(kTurndownPromptLastShown, last_shown_time.ToInternalValue());
+}
+
+} // namespace turndown_prompt
« no previous file with comments | « chrome_frame/turndown_prompt/reshow_state.h ('k') | chrome_frame/turndown_prompt/turndown_prompt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698