Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / passwords / manage_passwords_bubble_view.h
blob4976dba3420c8d77b7bbefc18bf544ac0273bff5
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
8 #include "base/basictypes.h"
9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
10 #include "ui/views/bubble/bubble_delegate.h"
11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/link.h"
13 #include "ui/views/controls/link_listener.h"
15 class ManagePasswordsIconView;
17 namespace content {
18 class WebContents;
21 namespace views {
22 class BlueButton;
23 class LabelButton;
26 class ManagePasswordsBubbleView : public views::BubbleDelegateView,
27 public views::ButtonListener,
28 public views::LinkListener {
29 public:
30 // Shows the bubble.
31 static void ShowBubble(content::WebContents* web_contents,
32 ManagePasswordsIconView* icon_view);
34 // Closes any existing bubble.
35 static void CloseBubble();
37 // Whether the bubble is currently showing.
38 static bool IsShowing();
40 private:
41 ManagePasswordsBubbleView(content::WebContents* web_contents,
42 views::View* anchor_view,
43 ManagePasswordsIconView* icon_view);
44 virtual ~ManagePasswordsBubbleView();
46 // Returns the maximum width needed for the username (if |username| is set) or
47 // password field, based on the actual usernames and passwords that need to be
48 // shown.
49 int GetMaximumUsernameOrPasswordWidth(bool username);
51 // If the bubble is not anchored to a view, places the bubble in the top
52 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s
53 // browser window. Because the positioning is based on the size of the
54 // bubble, this must be called after the bubble is created.
55 void AdjustForFullscreen(const gfx::Rect& screen_bounds);
57 void Close();
59 // views::BubbleDelegateView:
60 virtual void Init() OVERRIDE;
61 virtual void WindowClosing() OVERRIDE;
63 // views::ButtonListener:
64 virtual void ButtonPressed(views::Button* sender,
65 const ui::Event& event) OVERRIDE;
67 // views::LinkListener:
68 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
70 // Singleton instance of the Password bubble. The Password bubble can only be
71 // shown on the active browser window, so there is no case in which it will be
72 // shown twice at the same time.
73 static ManagePasswordsBubbleView* manage_passwords_bubble_;
75 ManagePasswordsBubbleModel* manage_passwords_bubble_model_;
76 ManagePasswordsIconView* icon_view_;
78 // The buttons that are shown in the bubble.
79 views::BlueButton* save_button_;
80 views::LabelButton* cancel_button_;
81 views::Link* manage_link_;
82 views::LabelButton* done_button_;
84 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView);
87 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_