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 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_ | 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_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" | |
9 #include "ui/views/controls/image_view.h" | 8 #include "ui/views/controls/image_view.h" |
10 #include "ui/views/widget/widget_observer.h" | 9 #include "ui/views/widget/widget_observer.h" |
11 | 10 |
12 class LocationBarView; | 11 class LocationBarView; |
13 class OpenPDFInReaderBubbleView; | 12 class OpenPDFInReaderBubbleView; |
14 class OpenPDFInReaderPromptDelegate; | 13 class OpenPDFInReaderPromptDelegate; |
15 | 14 |
16 namespace content { | 15 namespace content { |
17 class WebContents; | 16 class WebContents; |
18 } | 17 } |
19 | 18 |
20 // A Page Action image view for the "Open PDF in Reader" bubble. | 19 // A Page Action image view for the "Open PDF in Reader" bubble. |
21 class OpenPDFInReaderView : public views::ImageView, | 20 class OpenPDFInReaderView : public views::ImageView, |
22 public TouchableLocationBarView, | 21 public views::WidgetObserver { |
23 views::WidgetObserver { | |
24 public: | 22 public: |
25 explicit OpenPDFInReaderView(LocationBarView* location_bar_view); | 23 explicit OpenPDFInReaderView(LocationBarView* location_bar_view); |
26 virtual ~OpenPDFInReaderView(); | 24 virtual ~OpenPDFInReaderView(); |
27 | 25 |
28 void Update(content::WebContents* web_contents); | 26 void Update(content::WebContents* web_contents); |
29 | 27 |
30 // TouchableLocationBarView overrides: | |
31 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; | |
32 | |
33 private: | 28 private: |
34 void ShowBubble(); | 29 void ShowBubble(); |
35 | 30 |
36 // views::ImageView overrides: | 31 // views::ImageView: |
37 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 32 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
38 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 33 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
39 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 34 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
40 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 35 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
41 | 36 |
42 // views::WidgetObserver override: | 37 // views::WidgetObserver: |
43 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 38 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
44 | 39 |
45 // The LocationBarView hosting this view. | 40 // The LocationBarView hosting this view. |
46 LocationBarView* location_bar_view_; | 41 LocationBarView* location_bar_view_; |
47 | 42 |
48 OpenPDFInReaderBubbleView* bubble_; | 43 OpenPDFInReaderBubbleView* bubble_; |
49 | 44 |
50 // Weak pointer; owned by the PDFTabHelper of the currently active tab. | 45 // Weak pointer; owned by the PDFTabHelper of the currently active tab. |
51 OpenPDFInReaderPromptDelegate* model_; | 46 OpenPDFInReaderPromptDelegate* model_; |
52 | 47 |
53 DISALLOW_IMPLICIT_CONSTRUCTORS(OpenPDFInReaderView); | 48 DISALLOW_COPY_AND_ASSIGN(OpenPDFInReaderView); |
54 }; | 49 }; |
55 | 50 |
56 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_ | 51 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_ |
OLD | NEW |