wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 1 | // Copyright 2018 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 | |
Mitsuru Oshima | e5af41e6 | 2020-03-11 22:17:00 | [diff] [blame] | 5 | #ifndef ASH_SHORTCUT_VIEWER_VIEWS_KSV_SEARCH_BOX_VIEW_H_ |
| 6 | #define ASH_SHORTCUT_VIEWER_VIEWS_KSV_SEARCH_BOX_VIEW_H_ |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 7 | |
Jan Wilken Dörrie | ad587c3 | 2021-03-11 14:09:27 | [diff] [blame] | 8 | #include <string> |
| 9 | |
James Cook | 5531b71f | 2020-09-24 23:16:46 | [diff] [blame] | 10 | #include "ash/search_box/search_box_view_base.h" |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 11 | #include "base/macros.h" |
wutao | 3d134d7b | 2018-03-24 05:49:01 | [diff] [blame] | 12 | #include "base/strings/string16.h" |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 13 | |
James Cook | 55e8839 | 2020-09-25 03:57:55 | [diff] [blame] | 14 | namespace ash { |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 15 | class SearchBoxViewDelegate; |
James Cook | 55e8839 | 2020-09-25 03:57:55 | [diff] [blame] | 16 | } // namespace ash |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 17 | |
| 18 | namespace keyboard_shortcut_viewer { |
| 19 | |
Darwin Huang | 663c17d | 2020-02-06 01:10:01 | [diff] [blame] | 20 | // A search_box_SearchBoxViewBase implementation for KeyboardShortcutViewer. |
James Cook | 55e8839 | 2020-09-25 03:57:55 | [diff] [blame] | 21 | class KSVSearchBoxView : public ash::SearchBoxViewBase { |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 22 | public: |
James Cook | 55e8839 | 2020-09-25 03:57:55 | [diff] [blame] | 23 | explicit KSVSearchBoxView(ash::SearchBoxViewDelegate* delegate); |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 24 | ~KSVSearchBoxView() override = default; |
| 25 | |
| 26 | // views::View: |
| 27 | gfx::Size CalculatePreferredSize() const override; |
wutao | 3d134d7b | 2018-03-24 05:49:01 | [diff] [blame] | 28 | void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
wutao | d51700c | 2018-02-16 23:39:03 | [diff] [blame] | 29 | void OnKeyEvent(ui::KeyEvent* event) override; |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 30 | |
Jan Wilken Dörrie | 85285b0 | 2021-03-11 23:38:47 | [diff] [blame^] | 31 | void SetAccessibleValue(const std::u16string& value); |
wutao | 3d134d7b | 2018-03-24 05:49:01 | [diff] [blame] | 32 | |
Gavin Williams | c02b895 | 2020-10-27 17:29:15 | [diff] [blame] | 33 | // SearchBoxViewBase: |
| 34 | void OnSearchBoxActiveChanged(bool active) override; |
| 35 | |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 36 | private: |
James Cook | 55e8839 | 2020-09-25 03:57:55 | [diff] [blame] | 37 | // SearchBoxViewBase: |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 38 | void UpdateBackgroundColor(SkColor color) override; |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 39 | void UpdateSearchBoxBorder() override; |
| 40 | void SetupCloseButton() override; |
| 41 | void SetupBackButton() override; |
Gavin Williams | c02b895 | 2020-10-27 17:29:15 | [diff] [blame] | 42 | void SetPlaceholderTextAttributes(); |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 43 | |
wutao | 3d134d7b | 2018-03-24 05:49:01 | [diff] [blame] | 44 | // Accessibility data value. Used to pronounce the number of search results. |
Jan Wilken Dörrie | 85285b0 | 2021-03-11 23:38:47 | [diff] [blame^] | 45 | std::u16string accessible_value_; |
wutao | 3d134d7b | 2018-03-24 05:49:01 | [diff] [blame] | 46 | |
wutao | 5a1b5dc | 2018-02-12 20:33:00 | [diff] [blame] | 47 | DISALLOW_COPY_AND_ASSIGN(KSVSearchBoxView); |
| 48 | }; |
| 49 | |
| 50 | } // namespace keyboard_shortcut_viewer |
| 51 | |
Mitsuru Oshima | e5af41e6 | 2020-03-11 22:17:00 | [diff] [blame] | 52 | #endif // ASH_SHORTCUT_VIEWER_VIEWS_KSV_SEARCH_BOX_VIEW_H_ |