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_PAGE_ACTION_IMAGE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 ExtensionAction* page_action() { return page_action_; } | 43 ExtensionAction* page_action() { return page_action_; } |
44 | 44 |
45 int current_tab_id() { return current_tab_id_; } | 45 int current_tab_id() { return current_tab_id_; } |
46 | 46 |
47 void set_preview_enabled(bool preview_enabled) { | 47 void set_preview_enabled(bool preview_enabled) { |
48 preview_enabled_ = preview_enabled; | 48 preview_enabled_ = preview_enabled; |
49 } | 49 } |
50 | 50 |
51 // Overridden from views::View: | 51 // Overridden from views::View: |
| 52 virtual const char* GetClassName() const OVERRIDE; |
52 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 53 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
53 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 54 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
54 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 55 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
55 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 56 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| 57 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
56 | 58 |
57 // Overridden from ExtensionContextMenuModel::Delegate | 59 // Overridden from ExtensionContextMenuModel::Delegate |
58 virtual void InspectPopup() OVERRIDE; | 60 virtual void InspectPopup() OVERRIDE; |
59 | 61 |
60 // Overridden from views::WidgetObserver: | 62 // Overridden from views::WidgetObserver: |
61 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 63 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
62 | 64 |
63 // Overridden from views::ContextMenuController. | 65 // Overridden from views::ContextMenuController. |
64 virtual void ShowContextMenuForView(View* source, | 66 virtual void ShowContextMenuForView(View* source, |
65 const gfx::Point& point, | 67 const gfx::Point& point, |
66 ui::MenuSourceType source_type) OVERRIDE; | 68 ui::MenuSourceType source_type) OVERRIDE; |
67 | 69 |
68 // Overriden from ExtensionActionIconFactory::Observer. | 70 // Overriden from ExtensionActionIconFactory::Observer. |
69 virtual void OnIconUpdated() OVERRIDE; | 71 virtual void OnIconUpdated() OVERRIDE; |
70 | 72 |
71 // Overridden from ui::AcceleratorTarget: | 73 // Overridden from ui::AcceleratorTarget: |
72 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 74 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
73 virtual bool CanHandleAccelerators() const OVERRIDE; | 75 virtual bool CanHandleAccelerators() const OVERRIDE; |
74 | 76 |
75 // Called to notify the PageAction that it should determine whether to be | 77 // Called to notify the PageAction that it should determine whether to be |
76 // visible or hidden. |contents| is the WebContents that is active, |url| is | 78 // visible or hidden. |contents| is the WebContents that is active, |url| is |
77 // the current page URL. | 79 // the current page URL. |
78 void UpdateVisibility(content::WebContents* contents, const GURL& url); | 80 void UpdateVisibility(content::WebContents* contents, const GURL& url); |
79 | 81 |
80 // Either notify listeners or show a popup depending on the page action. | 82 // Either notify listeners or show a popup depending on the page action. |
81 void ExecuteAction(ExtensionPopup::ShowAction show_action); | 83 void ExecuteAction(ExtensionPopup::ShowAction show_action); |
82 | 84 |
83 private: | 85 private: |
| 86 static const char kViewClassName[]; |
| 87 |
84 // Overridden from View. | 88 // Overridden from View. |
85 virtual void PaintChildren(gfx::Canvas* canvas, | 89 virtual void PaintChildren(gfx::Canvas* canvas, |
86 const views::CullSet& cull_set) OVERRIDE; | 90 const views::CullSet& cull_set) OVERRIDE; |
87 | 91 |
88 // Shows the popup, with the given URL. | 92 // Shows the popup, with the given URL. |
89 void ShowPopupWithURL(const GURL& popup_url, | 93 void ShowPopupWithURL(const GURL& popup_url, |
90 ExtensionPopup::ShowAction show_action); | 94 ExtensionPopup::ShowAction show_action); |
91 | 95 |
92 // Hides the active popup, if there is one. | 96 // Hides the active popup, if there is one. |
93 void HidePopup(); | 97 void HidePopup(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // The extension command accelerator this page action is listening for (to | 131 // The extension command accelerator this page action is listening for (to |
128 // show the popup). | 132 // show the popup). |
129 scoped_ptr<ui::Accelerator> page_action_keybinding_; | 133 scoped_ptr<ui::Accelerator> page_action_keybinding_; |
130 | 134 |
131 scoped_ptr<views::MenuRunner> menu_runner_; | 135 scoped_ptr<views::MenuRunner> menu_runner_; |
132 | 136 |
133 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView); | 137 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView); |
134 }; | 138 }; |
135 | 139 |
136 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ | 140 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ |
OLD | NEW |