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