OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 8 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
9 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" |
10 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h" | |
10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
11 #include "ui/views/controls/image_view.h" | 12 #include "ui/views/controls/image_view.h" |
12 | 13 |
14 class CommandUpdater; | |
13 class ManagePasswordsBubbleUIController; | 15 class ManagePasswordsBubbleUIController; |
14 | 16 |
15 // View for the password icon in the Omnibox. | 17 // View for the password icon in the Omnibox. |
16 class ManagePasswordsIconView : public ManagePasswordsIcon, | 18 class ManagePasswordsIconView : public ManagePasswordsIcon, |
17 public views::ImageView { | 19 public BubbleIconView { |
18 public: | 20 public: |
19 // Clicking on the ManagePasswordsIconView shows a ManagePasswordsBubbleView, | 21 // Clicking on the ManagePasswordsIconView shows a ManagePasswordsBubbleView, |
20 // which requires the current WebContents. Because the current WebContents | 22 // which requires the current WebContents. Because the current WebContents |
21 // changes as the user switches tabs, it cannot be provided in the | 23 // changes as the user switches tabs, it cannot be provided in the |
22 // constructor. Instead, a LocationBarView::Delegate is passed here so that it | 24 // constructor. Instead, a LocationBarView::Delegate is passed here so that it |
23 // can be queried for the current WebContents as needed. | 25 // can be queried for the current WebContents as needed. |
24 explicit ManagePasswordsIconView( | 26 ManagePasswordsIconView(LocationBarView::Delegate* location_bar_delegate, |
25 LocationBarView::Delegate* location_bar_delegate); | 27 CommandUpdater* command_updater); |
26 virtual ~ManagePasswordsIconView(); | 28 virtual ~ManagePasswordsIconView(); |
27 | 29 |
28 // ManagePasswordsIcon: | 30 // ManagePasswordsIcon: |
31 // | |
32 // TODO(mkwst): Remove this once we get rid of the single call to | |
33 // ShowBubbleWithoutUserInteraction in ManagePasswordsBubbleUIController. | |
29 virtual void ShowBubbleWithoutUserInteraction() OVERRIDE; | 34 virtual void ShowBubbleWithoutUserInteraction() OVERRIDE; |
30 | 35 |
36 // BubbleIconView: | |
37 virtual bool IsBubbleShowing() const OVERRIDE; | |
38 virtual void OnExecuting(BubbleIconView::ExecuteSource source) OVERRIDE; | |
31 protected: | 39 protected: |
Peter Kasting
2014/04/25 22:12:02
Nit: Newline above this
Mike West
2014/04/28 10:52:56
Done.
| |
32 // ManagePasswordsIcon: | 40 // ManagePasswordsIcon: |
33 virtual void SetStateInternal(ManagePasswordsIcon::State state) OVERRIDE; | 41 virtual void SetStateInternal(ManagePasswordsIcon::State state) OVERRIDE; |
34 | 42 |
35 private: | 43 private: |
36 // views::ImageView: | |
37 virtual bool GetTooltipText(const gfx::Point& p, | |
38 base::string16* tooltip) const OVERRIDE; | |
39 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | |
40 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | |
41 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | |
42 | |
43 // The delegate used to get the currently visible WebContents. | 44 // The delegate used to get the currently visible WebContents. |
44 LocationBarView::Delegate* location_bar_delegate_; | 45 LocationBarView::Delegate* location_bar_delegate_; |
45 | 46 |
47 // The updater used to deliver commands to the browser; we'll use this to | |
48 // pop open the bubble when necessary. | |
49 // | |
50 // TODO(mkwst): Remove this once we get rid of the single call to | |
51 // ShowBubbleWithoutUserInteraction in ManagePasswordsBubbleUIController. | |
52 CommandUpdater* command_updater_; | |
53 | |
46 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIconView); | 54 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIconView); |
47 }; | 55 }; |
48 | 56 |
49 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEW_H_ | 57 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEW_H_ |
OLD | NEW |