File: manual_filling_view_interface.h

package info (click to toggle)
chromium 138.0.7204.157-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,864 kB
  • sloc: cpp: 34,936,859; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,967; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (97 lines) | stat: -rw-r--r-- 3,662 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_AUTOFILL_MANUAL_FILLING_VIEW_INTERFACE_H_
#define CHROME_BROWSER_AUTOFILL_MANUAL_FILLING_VIEW_INTERFACE_H_

#include <memory>
#include <vector>

#include "base/types/strong_alias.h"
#include "build/build_config.h"
#include "chrome/browser/keyboard_accessory/android/accessory_sheet_enums.h"

class ManualFillingController;

namespace autofill {
class AccessorySheetData;
}  // namespace autofill

namespace content {
class WebContents;
}  // namespace content

// The interface for creating and controlling a view for the password accessory.
// The view gets data from a given `ManualFillingController` and forwards
// any request (like filling a suggestion) back to the controller.
class ManualFillingViewInterface {
 public:
  // Defines which item types exist.
  // TODO(crbug.com/40601211): Remove this once AccessorySheetData is used on
  // the
  //                         frontend to represent data to present.
  // GENERATED_JAVA_ENUM_PACKAGE: (
  //   org.chromium.chrome.browser.autofill.keyboard_accessory)
  // GENERATED_JAVA_CLASS_NAME_OVERRIDE: ItemType
  enum class Type {
    // An item in title style to purely to display text. Non-interactive.
    LABEL = 1,  // e.g. the "Passwords for this site" section header.

    // An item in list style to displaying an interactive suggestion.
    SUGGESTION = 2,  // e.g. a user's email address used for sign-up.

    // An item in list style to displaying a non-interactive suggestion.
    NON_INTERACTIVE_SUGGESTION = 3,  // e.g. the "(No username)" suggestion.

    // A horizontal, non-interactive divider used to visually divide sections.
    DIVIDER = 4,

    // A single, usually static and interactive suggestion.
    OPTION = 5,  // e.g. the "Manage passwords..." link.

    // A horizontal, non-interactive divider used to visually divide the
    // accessory sheet from the accessory bar.
    TOP_DIVIDER = 6,
  };

  using WaitForKeyboard = base::StrongAlias<struct WaitForKeyboardTag, bool>;
  using ShouldShowAction = base::StrongAlias<struct ShouldShowActionTag, bool>;

  virtual ~ManualFillingViewInterface() = default;

  // Called with data that should replace the data currently shown in an
  // accessory sheet of the same type.
  virtual void OnItemsAvailable(autofill::AccessorySheetData data) = 0;

  // Called when a keyboard accessory action should be offered or rescinded.
  virtual void OnAccessoryActionAvailabilityChanged(
      ShouldShowAction shouldShowAction,
      autofill::AccessoryAction action) = 0;

  // Called to inform the view that the accessory sheet should be closed now.
  virtual void CloseAccessorySheet() = 0;

  // Opens a keyboard which dismisses the sheet. NoOp without open sheet.
  virtual void SwapSheetWithKeyboard() = 0;

  // Shows the accessory bar. If `wait_for_keyboard`, shows the bar when the
  // keyboard is also shown.
  virtual void Show(WaitForKeyboard wait_for_keyboard) = 0;

  // Hides the accessory bar and the accessory sheet (if open).
  virtual void Hide() = 0;

  // Shows the accessory sheet for the given `tab_type`.
  virtual void ShowAccessorySheetTab(
      const autofill::AccessoryTabType& tab_type) = 0;

 private:
  friend class ManualFillingControllerImpl;
  // Factory function used to create a concrete instance of this view.
  static std::unique_ptr<ManualFillingViewInterface> Create(
      ManualFillingController* controller,
      content::WebContents* web_contents);
};

#endif  // CHROME_BROWSER_AUTOFILL_MANUAL_FILLING_VIEW_INTERFACE_H_