Home | History | Annotate | Download | only in autofill
      1 // Copyright (c) 2012 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_AUTOFILL_AUTOFILL_POPUP_VIEW_H_
      6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_H_
      7 
      8 #include "ui/gfx/native_widget_types.h"
      9 
     10 namespace gfx {
     11 class Rect;
     12 }
     13 
     14 namespace ui {
     15 class KeyEvent;
     16 }
     17 
     18 namespace autofill {
     19 
     20 class AutofillPopupController;
     21 
     22 // The interface for creating and controlling a platform-dependent
     23 // AutofillPopupView.
     24 class AutofillPopupView {
     25  public:
     26   // The size of the border around the entire results popup, in pixels.
     27   static const int kBorderThickness = 1;
     28 
     29   // The minimum amount of padding between the Autofill name and subtext,
     30   // in pixels.
     31   static const size_t kNamePadding = 15;
     32 
     33   // The amount of padding between icons in pixels.
     34   static const int kIconPadding = 5;
     35 
     36   // The amount of padding at the end of the popup in pixels.
     37   static const int kEndPadding = 3;
     38 
     39   // Height of the delete icon in pixels.
     40   static const int kDeleteIconHeight = 16;
     41 
     42   // Width of the delete icon in pixels.
     43   static const int kDeleteIconWidth = 16;
     44 
     45   // Height of the Autofill icons in pixels.
     46   static const int kAutofillIconHeight = 16;
     47 
     48   // Width of the Autofill icons in pixels.
     49   static const int kAutofillIconWidth = 25;
     50 
     51   // Displays the Autofill popup and fills it in with data from the controller.
     52   virtual void Show() = 0;
     53 
     54   // Hides the popup from view. This will cause the popup to be deleted.
     55   virtual void Hide() = 0;
     56 
     57   // Invalidates the given row and redraw it.
     58   virtual void InvalidateRow(size_t row) = 0;
     59 
     60   // Refreshes the position of the popup.
     61   virtual void UpdateBoundsAndRedrawPopup() = 0;
     62 
     63   // Factory function for creating the view.
     64   static AutofillPopupView* Create(AutofillPopupController* controller);
     65 
     66  protected:
     67   virtual ~AutofillPopupView() {}
     68 };
     69 
     70 }  // namespace autofill
     71 
     72 #endif  // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_H_
     73