OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_CONTROLLER_H_ | |
7 | |
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | |
9 #include "content/public/browser/web_contents_observer.h" | |
10 #include "content/public/browser/web_contents_user_data.h" | |
11 | |
12 namespace content { | |
13 class WebContents; | |
14 } | |
15 | |
16 // Per-tab class to control the Omnibox password icon's visibility. | |
17 class ManagePasswordsIconController | |
18 : public TabSpecificContentSettings::PasswordObserver, | |
19 public content::WebContentsObserver, | |
20 public content::WebContentsUserData<ManagePasswordsIconController> { | |
21 public: | |
22 virtual ~ManagePasswordsIconController(); | |
23 | |
24 bool manage_passwords_icon_to_be_shown() const { | |
25 return manage_passwords_icon_to_be_shown_; | |
26 } | |
27 | |
28 bool password_to_be_saved() const { | |
29 return password_to_be_saved_; | |
30 } | |
31 | |
32 bool manage_passwords_bubble_needs_showing() const { | |
33 return manage_passwords_bubble_needs_showing_; | |
34 } | |
35 | |
36 // Called when the bubble is opened after the icon gets displayed. We change | |
37 // the state to know that we do not need to pop up the bubble again. | |
38 void OnBubbleShown(); | |
39 | |
40 private: | |
41 friend class content::WebContentsUserData<ManagePasswordsIconController>; | |
42 | |
43 explicit ManagePasswordsIconController(content::WebContents* web_contents); | |
44 | |
45 // TabSpecificContentSettings::PasswordObserver: | |
46 virtual void OnPasswordAction() OVERRIDE; | |
47 | |
48 bool manage_passwords_icon_to_be_shown_; | |
49 bool password_to_be_saved_; | |
50 bool manage_passwords_bubble_needs_showing_; | |
51 | |
52 content::BrowserContext* browser_context_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIconController); | |
55 }; | |
56 | |
57 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_CONTROLLER_H_ | |
OLD | NEW |