Chromium Code Reviews| 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; |