Chromium Code Reviews| 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/views/location_bar/location_bar_view.h" | 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 10 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
| 11 | 11 |
| 12 class CommandUpdater; | |
| 12 class ManagePasswordsBubbleUIController; | 13 class ManagePasswordsBubbleUIController; |
| 13 | 14 |
| 14 // View for the password icon in the Omnibox. | 15 // View for the password icon in the Omnibox. |
| 15 class ManagePasswordsIconView : public views::ImageView { | 16 class ManagePasswordsIconView : public views::ImageView { |
| 16 public: | 17 public: |
| 17 // Clicking on the ManagePasswordsIconView shows a ManagePasswordsBubbleView, | 18 // Clicking on the ManagePasswordsIconView shows a ManagePasswordsBubbleView, |
| 18 // which requires the current WebContents. Because the current WebContents | 19 // which requires the current WebContents. Because the current WebContents |
| 19 // changes as the user switches tabs, it cannot be provided in the | 20 // changes as the user switches tabs, it cannot be provided in the |
| 20 // constructor. Instead, a LocationBarView::Delegate is passed here so that it | 21 // constructor. Instead, a LocationBarView::Delegate is passed here so that it |
| 21 // can be queried for the current WebContents as needed. | 22 // can be queried for the current WebContents as needed. |
| 22 explicit ManagePasswordsIconView( | 23 explicit ManagePasswordsIconView( |
|
vabr (Chromium)
2014/04/22 14:32:06
You can drop the "explicit".
| |
| 23 LocationBarView::Delegate* location_bar_delegate); | 24 LocationBarView::Delegate* location_bar_delegate, |
| 25 CommandUpdater* command_updater); | |
| 24 virtual ~ManagePasswordsIconView(); | 26 virtual ~ManagePasswordsIconView(); |
| 25 | 27 |
| 26 // Updates the image and its tooltip appropriately, hiding or showing the icon | 28 // Updates the image and its tooltip appropriately, hiding or showing the icon |
| 27 // as needed. | 29 // as needed. |
| 28 void Update( | 30 void Update( |
| 29 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller); | 31 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller); |
| 30 | 32 |
| 31 // Shows a bubble from the icon if a password form was submitted. | 33 // Shows a bubble from the icon if a password form was submitted. |
| 32 void ShowBubbleIfNeeded( | 34 void ShowBubbleIfNeeded( |
| 33 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller); | 35 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller); |
| 34 | 36 |
| 35 void SetTooltip(bool password_to_be_saved); | 37 void SetTooltip(bool password_to_be_saved); |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 // views::ImageView: | 40 // views::ImageView: |
| 39 virtual bool GetTooltipText(const gfx::Point& p, | 41 virtual bool GetTooltipText(const gfx::Point& p, |
| 40 base::string16* tooltip) const OVERRIDE; | 42 base::string16* tooltip) const OVERRIDE; |
| 41 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 43 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 42 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 44 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 43 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 45 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 44 | 46 |
| 45 // The delegate used to get the currently visible WebContents. | 47 // The delegate used to get the currently visible WebContents. |
| 46 LocationBarView::Delegate* location_bar_delegate_; | 48 LocationBarView::Delegate* location_bar_delegate_; |
| 47 | 49 |
| 50 // The updater used to deliver commands to the browser; we'll use this to | |
| 51 // pop open the bubble when necessary. | |
| 52 CommandUpdater* command_updater_; | |
| 53 | |
| 48 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIconView); | 54 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIconView); |
| 49 }; | 55 }; |
| 50 | 56 |
| 51 #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 |