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..2901313c9ecc3f71ddd2b957ff0d0e911dc897a2 100644 |
--- a/chrome/browser/ui/ash/screenshot_taker.h |
+++ b/chrome/browser/ui/ash/screenshot_taker.h |
@@ -8,13 +8,37 @@ |
#include "ash/screenshot_delegate.h" |
#include "base/basictypes.h" |
#include "base/compiler_specific.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/time.h" |
-#include "ui/compositor/layer.h" |
namespace aura { |
class Window; |
} // namespace aura |
+namespace base { |
+class FilePath; |
+} // namespace base |
+ |
+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() {} |
+ |
+ virtual void OnScreenshotCompleted( |
+ Result screenshot_result, const base::FilePath& screenshot_path) = 0; |
+}; |
+ |
class ScreenshotTaker : public ash::ScreenshotDelegate { |
public: |
ScreenshotTaker(); |
@@ -26,20 +50,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); |
+ static ScreenshotTakerObserver* GetObserverForTest(); |
Jun Mukai
2013/03/29 23:01:37
move them to private methods and declare friend cl
sschmitz
2013/03/29 23:40:44
I think there would be a problem, because friendsh
Jun Mukai
2013/03/30 00:37:17
You can call the private methods from SetUp() of y
sschmitz
2013/04/02 21:23:25
I did what you suggested. Made the override functi
|
+ 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_; |
+ scoped_ptr<base::FilePath> screenshot_directory_for_test_; |
James Cook
2013/03/29 22:49:34
I don't think this needs to be a pointer - you sho
sschmitz
2013/03/29 23:40:44
Done.
|
+ |
+ static ScreenshotTakerObserver* observer_for_test_; |
Jun Mukai
2013/03/29 23:01:37
why static? I don't think your test needs to crea
sschmitz
2013/03/29 23:40:44
The reason for static is to avoid passing a weak p
Jun Mukai
2013/03/30 00:37:17
I still personally prefer non-static solution but
sschmitz
2013/04/02 21:23:25
Yes. Good point. I removed all statics in favor of
|
DISALLOW_COPY_AND_ASSIGN(ScreenshotTaker); |
}; |