Chromium Code Reviews| Index: chrome/browser/ui/ash/screenshot_taker.h |
| diff --git a/chrome/browser/ui/ash/screenshot_taker.h b/chrome/browser/ui/ash/screenshot_taker.h |
| index 6ba0416277b03db6dd6c6429a6725b2c03b38091..2ebda54f64855ce13665ed94ced0f250c7d7a82a 100644 |
| --- a/chrome/browser/ui/ash/screenshot_taker.h |
| +++ b/chrome/browser/ui/ash/screenshot_taker.h |
| @@ -8,13 +8,34 @@ |
| #include "ash/screenshot_delegate.h" |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| +#include "base/files/file_path.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/time.h" |
| -#include "ui/compositor/layer.h" |
| namespace aura { |
| class Window; |
| } // namespace aura |
| +class ScreenshotTakerObserver { |
| + public: |
| + enum Result { |
| + SCREENSHOT_SUCCESS = 0, |
| + SCREENSHOT_GRABWINDOW_PARTIAL_FAILED, |
| + SCREENSHOT_GRABWINDOW_FULL_FAILED, |
| + SCREENSHOT_CREATE_DIR_FAILED, |
| + SCREENSHOT_GET_DIR_FAILED, |
| + SCREENSHOT_CHECK_DIR_FAILED, |
| + SCREENSHOT_CREATE_FILE_FAILED, |
| + SCREENSHOT_WRITE_FILE_FAILED, |
| + SCREENSHOT_RESULT_COUNT |
| + }; |
| + |
| + virtual ~ScreenshotTakerObserver() {} |
|
sky
2013/03/31 01:16:03
Move this to protected to make it clear it's not o
sschmitz
2013/04/02 21:23:25
Done.
|
| + |
| + virtual void OnScreenshotCompleted( |
| + Result screenshot_result, const base::FilePath& screenshot_path) = 0; |
| +}; |
| + |
| class ScreenshotTaker : public ash::ScreenshotDelegate { |
| public: |
| ScreenshotTaker(); |
| @@ -26,20 +47,20 @@ class ScreenshotTaker : public ash::ScreenshotDelegate { |
| const gfx::Rect& rect) OVERRIDE; |
| virtual bool CanTakeScreenshot() OVERRIDE; |
| - private: |
| - // Flashes the screen to provide visual feedback that a screenshot has |
| - // been taken. |
| - void DisplayVisualFeedback(const gfx::Rect& rect); |
| + // For test we override the screenshot directory for cleanup. |
| + void SetScreenshotDirectoryForTest(const base::FilePath& directory); |
| - // Closes the visual feedback layer. |
| - void CloseVisualFeedbackLayer(); |
| + // For test we observe the completion of a screenshot. |
| + static void SetObserverForTest(ScreenshotTakerObserver* observer); |
|
sky
2013/03/31 01:16:03
If this is really only for a test, how about movin
sschmitz
2013/04/02 21:23:25
Made it general; used standard Observer list.
|
| + static ScreenshotTakerObserver* GetObserverForTest(); |
| + private: |
| // The timestamp when the screenshot task was issued last time. |
| base::Time last_screenshot_timestamp_; |
| - // The flashing effect of the screen for the visual feedback when taking a |
| - // screenshot. |
| - scoped_ptr<ui::Layer> visual_feedback_layer_; |
| + base::FilePath screenshot_directory_for_test_; |
| + |
| + static ScreenshotTakerObserver* observer_for_test_; |
| DISALLOW_COPY_AND_ASSIGN(ScreenshotTaker); |
| }; |