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/memory/scoped_ptr.h" | |
9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
12 | 13 |
13 class SkBitmap; | 14 class SkBitmap; |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class NavigationControllerImpl; | 18 class NavigationControllerImpl; |
18 class NavigationEntryImpl; | 19 class NavigationEntryImpl; |
19 class RenderViewHost; | 20 class RenderViewHost; |
20 class ScreenshotData; | 21 class ScreenshotData; |
22 class SiteInstanceKeepAlive; | |
21 | 23 |
22 // NavigationEntryScreenshotManager takes care of taking image-captures for the | 24 // NavigationEntryScreenshotManager takes care of taking image-captures for the |
23 // current navigation entry of a NavigationControllerImpl, and managing these | 25 // current navigation entry of a NavigationControllerImpl, and managing these |
24 // captured images. These image-captures are used for history navigation using | 26 // captured images. These image-captures are used for history navigation using |
25 // overscroll gestures. | 27 // overscroll gestures. |
26 class CONTENT_EXPORT NavigationEntryScreenshotManager { | 28 class CONTENT_EXPORT NavigationEntryScreenshotManager { |
27 public: | 29 public: |
28 explicit NavigationEntryScreenshotManager( | 30 explicit NavigationEntryScreenshotManager( |
29 NavigationControllerImpl* controller); | 31 NavigationControllerImpl* controller); |
30 virtual ~NavigationEntryScreenshotManager(); | 32 virtual ~NavigationEntryScreenshotManager(); |
(...skipping 12 matching lines...) Expand all Loading... | |
43 // Overridden in tests to get notified of when a screenshot is set. | 45 // Overridden in tests to get notified of when a screenshot is set. |
44 virtual void OnScreenshotSet(NavigationEntryImpl* entry); | 46 virtual void OnScreenshotSet(NavigationEntryImpl* entry); |
45 | 47 |
46 NavigationControllerImpl* owner() { return owner_; } | 48 NavigationControllerImpl* owner() { return owner_; } |
47 | 49 |
48 void SetMinScreenshotIntervalMS(int interval_ms); | 50 void SetMinScreenshotIntervalMS(int interval_ms); |
49 | 51 |
50 // The callback invoked when taking the screenshot of the page is complete. | 52 // The callback invoked when taking the screenshot of the page is complete. |
51 // This sets the screenshot on the navigation entry. | 53 // This sets the screenshot on the navigation entry. |
52 void OnScreenshotTaken(int unique_id, | 54 void OnScreenshotTaken(int unique_id, |
55 scoped_ptr<SiteInstanceKeepAlive> keep_alive, | |
53 bool success, | 56 bool success, |
54 const SkBitmap& bitmap); | 57 const SkBitmap& bitmap); |
55 | 58 |
59 void OnScreenshotTakenInTest(int unique_id, | |
sadrul
2014/02/20 05:13:31
This is to avoid exposing SiteInstanceKeepAlive ou
| |
60 bool success, | |
61 const SkBitmap& bitmap); | |
62 | |
56 // Returns the number of entries with screenshots. | 63 // Returns the number of entries with screenshots. |
57 int GetScreenshotCount() const; | 64 int GetScreenshotCount() const; |
58 | 65 |
59 private: | 66 private: |
60 // This is called when the screenshot data has beene encoded to PNG in a | 67 // This is called when the screenshot data has beene encoded to PNG in a |
61 // worker thread. | 68 // worker thread. |
62 void OnScreenshotEncodeComplete(int unique_id, | 69 void OnScreenshotEncodeComplete(int unique_id, |
63 scoped_refptr<ScreenshotData> data); | 70 scoped_refptr<ScreenshotData> data); |
64 | 71 |
65 // Removes the screenshot for the entry, returning true if the entry had a | 72 // Removes the screenshot for the entry, returning true if the entry had a |
(...skipping 15 matching lines...) Expand all Loading... | |
81 | 88 |
82 base::Time last_screenshot_time_; | 89 base::Time last_screenshot_time_; |
83 int min_screenshot_interval_ms_; | 90 int min_screenshot_interval_ms_; |
84 | 91 |
85 DISALLOW_COPY_AND_ASSIGN(NavigationEntryScreenshotManager); | 92 DISALLOW_COPY_AND_ASSIGN(NavigationEntryScreenshotManager); |
86 }; | 93 }; |
87 | 94 |
88 } // namespace content | 95 } // namespace content |
89 | 96 |
90 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ | 97 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ |
OLD | NEW |