• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_
7 
8 #include "ui/views/controls/image_view.h"
9 #include "ui/views/widget/widget_observer.h"
10 
11 class OpenPDFInReaderBubbleView;
12 
13 namespace content {
14 class WebContents;
15 }
16 
17 namespace pdf {
18 class OpenPDFInReaderPromptClient;
19 }
20 
21 // A Page Action image view for the "Open PDF in Reader" bubble.
22 class OpenPDFInReaderView : public views::ImageView,
23                             public views::WidgetObserver {
24  public:
25   OpenPDFInReaderView();
26   virtual ~OpenPDFInReaderView();
27 
28   void Update(content::WebContents* web_contents);
29 
30  private:
31   void ShowBubble();
32 
33   // views::ImageView:
34   virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
35   virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
36   virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
37   virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
38 
39   // views::WidgetObserver:
40   virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
41 
42   OpenPDFInReaderBubbleView* bubble_;
43 
44   // Weak pointer; owned by the PDFWebContentsHelper of the currently active
45   // tab.
46   pdf::OpenPDFInReaderPromptClient* model_;
47 
48   DISALLOW_COPY_AND_ASSIGN(OpenPDFInReaderView);
49 };
50 
51 #endif  // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_
52