open_pdf_in_reader_view.h revision ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16
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
11class LocationBarView;
12class OpenPDFInReaderBubbleView;
13class OpenPDFInReaderPromptDelegate;
14
15namespace content {
16class WebContents;
17}
18
19// A Page Action image view for the "Open PDF in Reader" bubble.
20class OpenPDFInReaderView : public views::ImageView,
21                            public views::WidgetObserver {
22 public:
23  explicit OpenPDFInReaderView(LocationBarView* location_bar_view);
24  virtual ~OpenPDFInReaderView();
25
26  void Update(content::WebContents* web_contents);
27
28 private:
29  void ShowBubble();
30
31  // views::ImageView:
32  virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
33  virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
34  virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
35  virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
36
37  // views::WidgetObserver:
38  virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
39
40  // The LocationBarView hosting this view.
41  LocationBarView* location_bar_view_;
42
43  OpenPDFInReaderBubbleView* bubble_;
44
45  // Weak pointer; owned by the PDFTabHelper of the currently active tab.
46  OpenPDFInReaderPromptDelegate* 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