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

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..77de1e72fab4a3b04634ab47b7717b3e0e25fe63 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();
@@ -138,6 +140,10 @@ ScreenshotTaker::ScreenshotTaker() {
ScreenshotTaker::~ScreenshotTaker() {
}
+void ScreenshotTaker::HandleTakeScreenshot(aura::Window* window) {
+ HandleTakePartialScreenshot(window, window->bounds());
+}
+
void ScreenshotTaker::HandleTakePartialScreenshot(
aura::Window* window, const gfx::Rect& rect) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
@@ -164,6 +170,7 @@ void ScreenshotTaker::HandleTakePartialScreenshot(
bool use_24hour_clock = ShouldUse24HourClock();
if (GrabWindowSnapshot(window, rect, &png_data->data())) {
+ last_screenshot_timestamp_ = base::Time::Now();
DisplayVisualFeedback(rect);
content::BrowserThread::PostTask(
content::BrowserThread::FILE, FROM_HERE,
@@ -174,8 +181,11 @@ void ScreenshotTaker::HandleTakePartialScreenshot(
}
}
-void ScreenshotTaker::HandleTakeScreenshot(aura::Window* window) {
- HandleTakePartialScreenshot(window, window->bounds());
+bool ScreenshotTaker::CanTakeScreenshot() {
+ return last_screenshot_timestamp_.is_null() ||
+ base::Time::Now() - last_screenshot_timestamp_ >
+ base::TimeDelta::FromMilliseconds(
+ kScreenshotMinimumIntervalInMS);
}
void ScreenshotTaker::CloseVisualFeedbackLayer() {
« 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