| 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 #include "chrome/browser/ui/snapshot_tab_helper.h" | 5 #include "chrome/browser/ui/snapshot_tab_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/tab_contents/tab_contents.h" | |
| 8 #include "chrome/common/chrome_notification_types.h" | 7 #include "chrome/common/chrome_notification_types.h" |
| 9 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 10 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
| 11 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 12 | 11 |
| 13 using content::WebContents; | 12 using content::WebContents; |
| 14 | 13 |
| 15 SnapshotTabHelper::SnapshotTabHelper(WebContents* tab) | 14 int SnapshotTabHelper::kUserDataKey; |
| 16 : content::WebContentsObserver(tab) { | 15 |
| 16 SnapshotTabHelper::SnapshotTabHelper(WebContents* web_contents) |
| 17 : content::WebContentsObserver(web_contents) { |
| 17 } | 18 } |
| 18 | 19 |
| 19 SnapshotTabHelper::~SnapshotTabHelper() { | 20 SnapshotTabHelper::~SnapshotTabHelper() { |
| 20 } | 21 } |
| 21 | 22 |
| 22 void SnapshotTabHelper::CaptureSnapshot() { | 23 void SnapshotTabHelper::CaptureSnapshot() { |
| 23 Send(new ChromeViewMsg_CaptureSnapshot(routing_id())); | 24 Send(new ChromeViewMsg_CaptureSnapshot(routing_id())); |
| 24 } | 25 } |
| 25 | 26 |
| 26 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 | 38 |
| 38 //////////////////////////////////////////////////////////////////////////////// | 39 //////////////////////////////////////////////////////////////////////////////// |
| 39 // Internal helpers | 40 // Internal helpers |
| 40 | 41 |
| 41 void SnapshotTabHelper::OnSnapshot(const SkBitmap& bitmap) { | 42 void SnapshotTabHelper::OnSnapshot(const SkBitmap& bitmap) { |
| 42 content::NotificationService::current()->Notify( | 43 content::NotificationService::current()->Notify( |
| 43 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, | 44 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, |
| 44 content::Source<WebContents>(web_contents()), | 45 content::Source<WebContents>(web_contents()), |
| 45 content::Details<const SkBitmap>(&bitmap)); | 46 content::Details<const SkBitmap>(&bitmap)); |
| 46 } | 47 } |
| OLD | NEW |