Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: chrome/browser/ui/snapshot_tab_helper.cc

Issue 12770014: Restore SnapshotTabHelper temporarily (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/snapshot_tab_helper.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/snapshot_tab_helper.h"
6
7 #include "chrome/common/chrome_notification_types.h"
8 #include "chrome/common/render_messages.h"
9 #include "content/public/browser/notification_service.h"
10 #include "content/public/browser/web_contents.h"
11
12 using content::WebContents;
13
14 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SnapshotTabHelper);
15
16 SnapshotTabHelper::SnapshotTabHelper(WebContents* web_contents)
17 : content::WebContentsObserver(web_contents) {
18 }
19
20 SnapshotTabHelper::~SnapshotTabHelper() {
21 }
22
23 void SnapshotTabHelper::CaptureSnapshot() {
24 Send(new ChromeViewMsg_CaptureSnapshot(routing_id()));
25 }
26
27 ////////////////////////////////////////////////////////////////////////////////
28 // WebContentsObserver overrides
29
30 bool SnapshotTabHelper::OnMessageReceived(const IPC::Message& message) {
31 bool handled = true;
32 IPC_BEGIN_MESSAGE_MAP(SnapshotTabHelper, message)
33 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_Snapshot, OnSnapshot)
34 IPC_MESSAGE_UNHANDLED(handled = false)
35 IPC_END_MESSAGE_MAP()
36 return handled;
37 }
38
39 ////////////////////////////////////////////////////////////////////////////////
40 // Internal helpers
41
42 void SnapshotTabHelper::OnSnapshot(const SkBitmap& bitmap) {
43 content::NotificationService::current()->Notify(
44 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN,
45 content::Source<WebContents>(web_contents()),
46 content::Details<const SkBitmap>(&bitmap));
47 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/snapshot_tab_helper.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698