OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 |
| 10 // Abstract base class for platform-specific password management icon views. |
| 11 class ManagePasswordsIcon { |
| 12 public: |
| 13 enum State { |
| 14 // The icon should not be displayed. |
| 15 INACTIVE_STATE, |
| 16 |
| 17 // The user has blacklisted the current page; the icon should be visible, |
| 18 // and correctly represent the password manager's disabled state. |
| 19 BLACKLISTED_STATE, |
| 20 |
| 21 // Offer the user the ability to manage passwords for the current page. |
| 22 MANAGE_STATE, |
| 23 |
| 24 // Offer the user the ability to save a pending password. |
| 25 PENDING_STATE, |
| 26 }; |
| 27 |
| 28 // Get/set the icon's state. Implementations of this class must implement |
| 29 // SetStateInternal to do reasonable platform-specific things to represent |
| 30 // the icon's state to the user. |
| 31 void SetState(State state); |
| 32 State state() const { return state_; } |
| 33 |
| 34 // Shows the bubble without user interaction; should only be called from |
| 35 // ManagePasswordsUIController. |
| 36 // |
| 37 // TODO(mkwst): This shouldn't be the IconView's responsiblity. Move it |
| 38 // somewhere else as part of the refactoring in http://crbug.com/365678. |
| 39 virtual void ShowBubbleWithoutUserInteraction() = 0; |
| 40 |
| 41 protected: |
| 42 ManagePasswordsIcon(); |
| 43 ~ManagePasswordsIcon(); |
| 44 |
| 45 // Called from SetState() iff the icon's state has changed. |
| 46 virtual void SetStateInternal(State state) = 0; |
| 47 |
| 48 private: |
| 49 State state_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIcon); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_ICON_H_ |
OLD | NEW |