| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/public/browser/readback_types.h" | 13 #include "content/public/browser/readback_types.h" |
| 14 | 14 |
| 15 class SkBitmap; | 15 class SkBitmap; |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class NavigationControllerImpl; | 19 class NavigationControllerImpl; |
| 20 class NavigationEntryImpl; | 20 class NavigationEntryImpl; |
| 21 class RenderViewHost; | |
| 22 class ScreenshotData; | 21 class ScreenshotData; |
| 23 | 22 |
| 24 // NavigationEntryScreenshotManager takes care of taking image-captures for the | 23 // NavigationEntryScreenshotManager takes care of taking image-captures for the |
| 25 // current navigation entry of a NavigationControllerImpl, and managing these | 24 // current navigation entry of a NavigationControllerImpl, and managing these |
| 26 // captured images. These image-captures are used for history navigation using | 25 // captured images. These image-captures are used for history navigation using |
| 27 // overscroll gestures. | 26 // overscroll gestures. |
| 28 class CONTENT_EXPORT NavigationEntryScreenshotManager { | 27 class CONTENT_EXPORT NavigationEntryScreenshotManager { |
| 29 public: | 28 public: |
| 30 explicit NavigationEntryScreenshotManager( | 29 explicit NavigationEntryScreenshotManager( |
| 31 NavigationControllerImpl* controller); | 30 NavigationControllerImpl* controller); |
| 32 virtual ~NavigationEntryScreenshotManager(); | 31 virtual ~NavigationEntryScreenshotManager(); |
| 33 | 32 |
| 34 // Takes a screenshot of the last-committed entry of the controller. | 33 // Takes a screenshot of the last-committed entry of the controller. |
| 35 void TakeScreenshot(); | 34 void TakeScreenshot(); |
| 36 | 35 |
| 37 // Clears screenshots of all navigation entries. | 36 // Clears screenshots of all navigation entries. |
| 38 void ClearAllScreenshots(); | 37 void ClearAllScreenshots(); |
| 39 | 38 |
| 40 protected: | 39 protected: |
| 41 virtual void TakeScreenshotImpl(RenderViewHost* host, | |
| 42 NavigationEntryImpl* entry); | |
| 43 | |
| 44 // Called after a screenshot has been set on an NavigationEntryImpl. | 40 // Called after a screenshot has been set on an NavigationEntryImpl. |
| 45 // Overridden in tests to get notified of when a screenshot is set. | 41 // Overridden in tests to get notified of when a screenshot is set. |
| 46 virtual void OnScreenshotSet(NavigationEntryImpl* entry); | 42 virtual void OnScreenshotSet(NavigationEntryImpl* entry); |
| 47 | 43 |
| 48 NavigationControllerImpl* owner() { return owner_; } | 44 NavigationControllerImpl* owner() { return owner_; } |
| 49 | 45 |
| 50 void SetMinScreenshotIntervalMS(int interval_ms); | 46 void SetMinScreenshotIntervalMS(int interval_ms); |
| 51 | 47 |
| 52 // The callback invoked when taking the screenshot of the page is complete. | 48 // The callback invoked when taking the screenshot of the page is complete. |
| 53 // This sets the screenshot on the navigation entry. | 49 // This sets the screenshot on the navigation entry. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 83 // the callback to make sure that the screenshot/encoding completion callback | 79 // the callback to make sure that the screenshot/encoding completion callback |
| 84 // does not trigger on a destroyed NavigationEntryScreenshotManager. | 80 // does not trigger on a destroyed NavigationEntryScreenshotManager. |
| 85 base::WeakPtrFactory<NavigationEntryScreenshotManager> screenshot_factory_; | 81 base::WeakPtrFactory<NavigationEntryScreenshotManager> screenshot_factory_; |
| 86 | 82 |
| 87 DISALLOW_COPY_AND_ASSIGN(NavigationEntryScreenshotManager); | 83 DISALLOW_COPY_AND_ASSIGN(NavigationEntryScreenshotManager); |
| 88 }; | 84 }; |
| 89 | 85 |
| 90 } // namespace content | 86 } // namespace content |
| 91 | 87 |
| 92 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ | 88 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ |
| OLD | NEW |