| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_SNAPSHOT_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_SNAPSHOT_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_UI_SNAPSHOT_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_SNAPSHOT_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/common/web_contents_user_data.h" | 8 #include "chrome/browser/common/web_contents_user_data.h" |
| 9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
| 10 | 10 |
| 11 class SkBitmap; | 11 class SkBitmap; |
| 12 | 12 |
| 13 // Per-tab class to handle snapshot functionality. | 13 // Per-tab class to handle snapshot functionality. |
| 14 class SnapshotTabHelper : public content::WebContentsObserver, | 14 class SnapshotTabHelper : public content::WebContentsObserver, |
| 15 public WebContentsUserData<SnapshotTabHelper> { | 15 public WebContentsUserData<SnapshotTabHelper> { |
| 16 public: | 16 public: |
| 17 virtual ~SnapshotTabHelper(); | 17 virtual ~SnapshotTabHelper(); |
| 18 | 18 |
| 19 // Captures a snapshot of the page. | 19 // Captures a snapshot of the page. |
| 20 void CaptureSnapshot(); | 20 void CaptureSnapshot(); |
| 21 | 21 |
| 22 private: | 22 private: |
| 23 explicit SnapshotTabHelper(content::WebContents* web_contents); | 23 explicit SnapshotTabHelper(content::WebContents* web_contents); |
| 24 static int kUserDataKey; | |
| 25 friend class WebContentsUserData<SnapshotTabHelper>; | 24 friend class WebContentsUserData<SnapshotTabHelper>; |
| 26 | 25 |
| 27 // content::WebContentsObserver overrides: | 26 // content::WebContentsObserver overrides: |
| 28 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 27 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 29 | 28 |
| 30 // Internal helpers ---------------------------------------------------------- | 29 // Internal helpers ---------------------------------------------------------- |
| 31 | 30 |
| 32 // Message handler. | 31 // Message handler. |
| 33 void OnSnapshot(const SkBitmap& bitmap); | 32 void OnSnapshot(const SkBitmap& bitmap); |
| 34 | 33 |
| 35 DISALLOW_COPY_AND_ASSIGN(SnapshotTabHelper); | 34 DISALLOW_COPY_AND_ASSIGN(SnapshotTabHelper); |
| 36 }; | 35 }; |
| 37 | 36 |
| 38 #endif // CHROME_BROWSER_UI_SNAPSHOT_TAB_HELPER_H_ | 37 #endif // CHROME_BROWSER_UI_SNAPSHOT_TAB_HELPER_H_ |
| OLD | NEW |