OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PASSWORDS_MANAGE_PASSWORDS_ICON_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_H_ |
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/browser/ui/passwords/manage_passwords_icon_view.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_icon_view.h" |
10 #include "components/password_manager/core/common/password_manager_ui.h" | 10 #include "components/password_manager/core/common/password_manager_ui.h" |
11 | 11 |
12 // Base class for platform-specific password management icon views. | 12 // Base class for platform-specific password management icon views. |
13 // TODO(estade): remove this class from Cocoa as it has been from Views. | 13 // TODO(estade): remove this class from Cocoa as it has been from Views. |
14 class ManagePasswordsIcon : public ManagePasswordsIconView { | 14 class ManagePasswordsIcon : public ManagePasswordsIconView { |
15 public: | 15 public: |
16 // Get/set the icon's state. Implementations of this class must implement | 16 // Get/set the icon's state. Implementations of this class must implement |
17 // SetStateInternal to do reasonable platform-specific things to represent | 17 // SetStateInternal to do reasonable platform-specific things to represent |
18 // the icon's state to the user. | 18 // the icon's state to the user. |
19 void SetState(password_manager::ui::State state) override; | 19 void SetState(password_manager::ui::State state) override; |
20 password_manager::ui::State state() const { return state_; } | 20 password_manager::ui::State state() const { return state_; } |
21 | 21 |
22 void SetActive(bool active) override; | 22 void SetActive(bool active); |
23 bool active() const { return active_; } | 23 bool active() const { return active_; } |
24 | 24 |
25 protected: | 25 protected: |
26 // The ID of the icon and text resources that are currently displayed. | 26 // The ID of the icon and text resources that are currently displayed. |
27 int icon_id_; | 27 int icon_id_; |
28 int tooltip_text_id_; | 28 int tooltip_text_id_; |
29 | 29 |
30 ManagePasswordsIcon(); | 30 ManagePasswordsIcon(); |
31 ~ManagePasswordsIcon(); | 31 ~ManagePasswordsIcon(); |
32 | 32 |
33 // Called from SetState() and SetActive() in order to do whatever | 33 // Called from SetState() and SetActive() in order to do whatever |
34 // platform-specific UI work is necessary. | 34 // platform-specific UI work is necessary. |
35 virtual void UpdateVisibleUI() = 0; | 35 virtual void UpdateVisibleUI() = 0; |
36 | 36 |
37 // Called from SetState() iff the icon's state has changed. | 37 // Called from SetState() iff the icon's state has changed. |
38 virtual void OnChangingState() = 0; | 38 virtual void OnChangingState() = 0; |
39 | 39 |
40 private: | 40 private: |
41 // Updates the resource IDs in response to state changes. | 41 // Updates the resource IDs in response to state changes. |
42 void UpdateIDs(); | 42 void UpdateIDs(); |
43 | 43 |
44 password_manager::ui::State state_; | 44 password_manager::ui::State state_; |
45 bool active_; | 45 bool active_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIcon); | 47 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIcon); |
48 }; | 48 }; |
49 | 49 |
50 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_H_ | 50 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_H_ |
OLD | NEW |