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

ash / system / accessibility / accessibility_feature_disable_dialog.h [blame]

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SYSTEM_ACCESSIBILITY_ACCESSIBILITY_FEATURE_DISABLE_DIALOG_H_
#define ASH_SYSTEM_ACCESSIBILITY_ACCESSIBILITY_FEATURE_DISABLE_DIALOG_H_

#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/window/dialog_delegate.h"

namespace ash {

// Defines a dialog for accessibility features that require confirmation from
// users prior to being disabled. For features like automatic clicks and switch
// access, accidentally disabling the feature could cause users to be unable to
// use their devices.
class AccessibilityFeatureDisableDialog : public views::DialogDelegateView {
  METADATA_HEADER(AccessibilityFeatureDisableDialog, views::DialogDelegateView)
 public:
  AccessibilityFeatureDisableDialog(int window_title_text_id,
                                    base::OnceClosure on_accept_callback,
                                    base::OnceClosure on_cancel_callback);

  AccessibilityFeatureDisableDialog(const AccessibilityFeatureDisableDialog&) =
      delete;
  AccessibilityFeatureDisableDialog& operator=(
      const AccessibilityFeatureDisableDialog&) = delete;

  ~AccessibilityFeatureDisableDialog() override;

  base::WeakPtr<AccessibilityFeatureDisableDialog> GetWeakPtr();

 private:
  base::OnceClosure on_cancel_callback_;

  base::WeakPtrFactory<AccessibilityFeatureDisableDialog> weak_ptr_factory_{
      this};
};

}  // namespace ash

#endif  // ASH_SYSTEM_ACCESSIBILITY_ACCESSIBILITY_FEATURE_DISABLE_DIALOG_H_