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

Side by Side Diff: chrome/browser/ui/pdf/pdf_tab_helper.h

Issue 10993064: Make using WebContentsUserData simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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
OLDNEW
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_PDF_PDF_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_PDF_PDF_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_PDF_PDF_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_PDF_PDF_TAB_HELPER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/common/web_contents_user_data.h" 9 #include "chrome/browser/common/web_contents_user_data.h"
10 #include "content/public/browser/web_contents_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
11 11
12 class OpenPDFInReaderPromptDelegate; 12 class OpenPDFInReaderPromptDelegate;
13 13
14 namespace content { 14 namespace content {
15 class WebContents; 15 class WebContents;
16 } 16 }
17 17
18 // Per-tab class to handle PDF messages. 18 // Per-tab class to handle PDF messages.
19 class PDFTabHelper : public content::WebContentsObserver, 19 class PDFTabHelper : public content::WebContentsObserver,
20 public WebContentsUserData<PDFTabHelper> { 20 public WebContentsUserData<PDFTabHelper> {
21 public: 21 public:
22 static int kUserDataKey;
23 22
24 explicit PDFTabHelper(content::WebContents* web_contents); 23 explicit PDFTabHelper(content::WebContents* web_contents);
25 virtual ~PDFTabHelper(); 24 virtual ~PDFTabHelper();
26 25
27 OpenPDFInReaderPromptDelegate* open_in_reader_prompt() const { 26 OpenPDFInReaderPromptDelegate* open_in_reader_prompt() const {
28 return open_in_reader_prompt_.get(); 27 return open_in_reader_prompt_.get();
29 } 28 }
30 29
31 void ShowOpenInReaderPrompt(scoped_ptr<OpenPDFInReaderPromptDelegate> prompt); 30 void ShowOpenInReaderPrompt(scoped_ptr<OpenPDFInReaderPromptDelegate> prompt);
32 31
(...skipping 11 matching lines...) Expand all
44 // Message handlers. 43 // Message handlers.
45 void OnPDFHasUnsupportedFeature(); 44 void OnPDFHasUnsupportedFeature();
46 45
47 // The model for the confirmation prompt to open a PDF in Adobe Reader. 46 // The model for the confirmation prompt to open a PDF in Adobe Reader.
48 scoped_ptr<OpenPDFInReaderPromptDelegate> open_in_reader_prompt_; 47 scoped_ptr<OpenPDFInReaderPromptDelegate> open_in_reader_prompt_;
49 48
50 DISALLOW_COPY_AND_ASSIGN(PDFTabHelper); 49 DISALLOW_COPY_AND_ASSIGN(PDFTabHelper);
51 }; 50 };
52 51
53 #endif // CHROME_BROWSER_UI_PDF_PDF_TAB_HELPER_H_ 52 #endif // CHROME_BROWSER_UI_PDF_PDF_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698