remove_query_confirmation_dialog.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright (c) 2019 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. #ifndef ASH_APP_LIST_VIEWS_REMOVE_QUERY_CONFIRMATION_DIALOG_H_
  5. #define ASH_APP_LIST_VIEWS_REMOVE_QUERY_CONFIRMATION_DIALOG_H_
  6. #include <memory>
  7. #include "base/callback.h"
  8. #include "ui/views/widget/widget_delegate.h"
  9. namespace views {
  10. class Button;
  11. class Label;
  12. } // namespace views
  13. namespace ash {
  14. class ViewShadow;
  15. // RemoveQueryConfirmationDialog displays the confirmation dialog for removing
  16. // a recent query suggestion.
  17. class RemoveQueryConfirmationDialog : public views::WidgetDelegateView {
  18. public:
  19. // Callback to notify user's confirmation for removing the zero state
  20. // suggestion query. Invoked with true if user confirms removing query
  21. // suggestion; and false for declining the removal. The second parameter is
  22. // the event flags of user action for invoking the removal action on the
  23. // associated result.
  24. using RemovalConfirmationCallback = base::OnceCallback<void(bool)>;
  25. RemoveQueryConfirmationDialog(RemovalConfirmationCallback callback,
  26. const std::u16string& result_title);
  27. RemoveQueryConfirmationDialog(const RemoveQueryConfirmationDialog&) = delete;
  28. RemoveQueryConfirmationDialog& operator=(
  29. const RemoveQueryConfirmationDialog&) = delete;
  30. ~RemoveQueryConfirmationDialog() override;
  31. // views::View:
  32. const char* GetClassName() const override;
  33. gfx::Size CalculatePreferredSize() const override;
  34. void OnThemeChanged() override;
  35. void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
  36. views::Button* cancel_button_for_test() { return cancel_button_; }
  37. views::Button* accept_button_for_test() { return accept_button_; }
  38. private:
  39. RemovalConfirmationCallback confirm_callback_;
  40. std::unique_ptr<ViewShadow> view_shadow_;
  41. views::Label* title_ = nullptr;
  42. views::Label* body_ = nullptr;
  43. views::Button* cancel_button_ = nullptr;
  44. views::Button* accept_button_ = nullptr;
  45. };
  46. } // namespace ash
  47. #endif // ASH_APP_LIST_VIEWS_REMOVE_QUERY_CONFIRMATION_DIALOG_H_