| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/snapshot/screenshot_grabber.h" | 5 #include "ui/snapshot/screenshot_grabber.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <climits> | 9 #include <climits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 base::TimeDelta::FromMilliseconds(kScreenshotMinimumIntervalInMS); | 180 base::TimeDelta::FromMilliseconds(kScreenshotMinimumIntervalInMS); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void ScreenshotGrabber::NotifyScreenshotCompleted( | 183 void ScreenshotGrabber::NotifyScreenshotCompleted( |
| 184 ScreenshotGrabberObserver::Result screenshot_result, | 184 ScreenshotGrabberObserver::Result screenshot_result, |
| 185 const base::FilePath& screenshot_path) { | 185 const base::FilePath& screenshot_path) { |
| 186 DCHECK(base::MessageLoopForUI::IsCurrent()); | 186 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 187 #if defined(USE_AURA) | 187 #if defined(USE_AURA) |
| 188 cursor_hider_.reset(); | 188 cursor_hider_.reset(); |
| 189 #endif | 189 #endif |
| 190 FOR_EACH_OBSERVER(ScreenshotGrabberObserver, observers_, | 190 for (ScreenshotGrabberObserver& observer : observers_) |
| 191 OnScreenshotCompleted(screenshot_result, screenshot_path)); | 191 observer.OnScreenshotCompleted(screenshot_result, screenshot_path); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void ScreenshotGrabber::AddObserver(ScreenshotGrabberObserver* observer) { | 194 void ScreenshotGrabber::AddObserver(ScreenshotGrabberObserver* observer) { |
| 195 observers_.AddObserver(observer); | 195 observers_.AddObserver(observer); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ScreenshotGrabber::RemoveObserver(ScreenshotGrabberObserver* observer) { | 198 void ScreenshotGrabber::RemoveObserver(ScreenshotGrabberObserver* observer) { |
| 199 observers_.RemoveObserver(observer); | 199 observers_.RemoveObserver(observer); |
| 200 } | 200 } |
| 201 | 201 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 228 | 228 |
| 229 ShowNotificationCallback notification_callback(base::Bind( | 229 ShowNotificationCallback notification_callback(base::Bind( |
| 230 &ScreenshotGrabber::NotifyScreenshotCompleted, factory_.GetWeakPtr())); | 230 &ScreenshotGrabber::NotifyScreenshotCompleted, factory_.GetWeakPtr())); |
| 231 client_->PrepareFileAndRunOnBlockingPool( | 231 client_->PrepareFileAndRunOnBlockingPool( |
| 232 screenshot_path, blocking_task_runner_, | 232 screenshot_path, blocking_task_runner_, |
| 233 base::Bind(&SaveScreenshot, base::ThreadTaskRunnerHandle::Get(), | 233 base::Bind(&SaveScreenshot, base::ThreadTaskRunnerHandle::Get(), |
| 234 notification_callback, screenshot_path, png_data)); | 234 notification_callback, screenshot_path, png_data)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace ui | 237 } // namespace ui |
| OLD | NEW |