Home | History | Annotate | Download | only in common
      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 COMPONENTS_PASSWORD_MANAGER_CORE_COMMON_PASSWORD_MANAGER_UI_H_
      6 #define COMPONENTS_PASSWORD_MANAGER_CORE_COMMON_PASSWORD_MANAGER_UI_H_
      7 
      8 #include "base/basictypes.h"
      9 
     10 namespace password_manager {
     11 
     12 namespace ui {
     13 
     14 // The current state of the password manager's UI.
     15 enum State {
     16   // The password manager has nothing to do with the current site.
     17   INACTIVE_STATE,
     18 
     19   // A password has been typed in and submitted successfully. Now we need to
     20   // display an Omnibox icon, and pop up a bubble asking the user whether
     21   // they'd like to save the password.
     22   PENDING_PASSWORD_AND_BUBBLE_STATE,
     23 
     24   // A password is pending, but we don't need to pop up a bubble.
     25   PENDING_PASSWORD_STATE,
     26 
     27   // A password has been saved and we wish to display UI confirming the save
     28   // to the user.
     29   CONFIRMATION_STATE,
     30 
     31   // A password has been autofilled, or has just been saved. The icon needs
     32   // to be visible, in the management state.
     33   MANAGE_STATE,
     34 
     35   // The user has blacklisted the site rendered in the current WebContents.
     36   // The icon needs to be visible, in the blacklisted state.
     37   BLACKLIST_STATE,
     38 };
     39 
     40 // The position of a password item in a list of credentials.
     41 enum PasswordItemPosition {
     42   // The password item is the first in the list.
     43   FIRST_ITEM,
     44 
     45   // The password item is not the first item in the list.
     46   SUBSEQUENT_ITEM,
     47 };
     48 
     49 // Returns true if |state| represents a pending password.
     50 bool IsPendingState(State state);
     51 
     52 // Returns true if this state show cause the bubble to be shown without user
     53 // interaction.
     54 bool IsAutomaticDisplayState(State state);
     55 
     56 // Returns the state that the bubble should be in after the automatic display
     57 // occurs.
     58 State GetEndStateForAutomaticState(State state);
     59 
     60 }  // namespace ui
     61 
     62 }  // namespace password_manager
     63 
     64 #endif  // COMPONENTS_PASSWORD_MANAGER_CORE_COMMON_PASSWORD_MANAGER_UI_H_
     65