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

Unified Diff: chrome/browser/ui/ash/screenshot_taker.cc

Issue 10802046: Ignores screenshot taking invocations if it's too close to the previous one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/browser/ui/ash/screenshot_taker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/screenshot_taker.cc
diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc
index 3e9d6556604afb0d6749556cb4303679259d2b64..0e26839b441357591eede00aa1f91bf53999a7f0 100644
--- a/chrome/browser/ui/ash/screenshot_taker.cc
+++ b/chrome/browser/ui/ash/screenshot_taker.cc
@@ -33,6 +33,8 @@
#endif
namespace {
+const int kScreenshotMinimumIntervalInMS = 500;
+
bool ShouldUse24HourClock() {
#if defined(OS_CHROMEOS)
Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
@@ -142,6 +144,19 @@ void ScreenshotTaker::HandleTakePartialScreenshot(
aura::Window* window, const gfx::Rect& rect) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ aura::RootWindow* root_window = window->GetRootWindow();
sky 2012/07/20 16:13:31 Do we really care about what root window this came
Jun Mukai 2012/07/20 17:07:32 This method is invoked several times for a single
+ base::Time now = base::Time::Now();
+ std::map<aura::RootWindow*, base::Time>::const_iterator iter =
+ last_screenshot_timestamps_.find(root_window);
+ if (iter != last_screenshot_timestamps_.end()) {
+ base::Time last = iter->second;
+ // Ignore if the command is issued too closely to the last command.
+ if (now - last <= base::TimeDelta::FromMilliseconds(
+ kScreenshotMinimumIntervalInMS))
+ return;
+ }
+ last_screenshot_timestamps_[root_window] = now;
+
scoped_refptr<base::RefCountedBytes> png_data(new base::RefCountedBytes);
bool is_logged_in = true;
« no previous file with comments | « chrome/browser/ui/ash/screenshot_taker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698