OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_OPTIONS_STYLUS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_OPTIONS_STYLUS_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_OPTIONS_STYLUS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_OPTIONS_STYLUS_HANDLER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/chromeos/note_taking_helper.h" | 13 #include "chrome/browser/chromeos/note_taking_helper.h" |
14 #include "chrome/browser/ui/webui/options/options_ui.h" | 14 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 15 #include "ui/events/devices/input_device_event_observer.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class ListValue; | 18 class ListValue; |
18 } // namespace base | 19 } // namespace base |
19 | 20 |
20 namespace chromeos { | 21 namespace chromeos { |
21 namespace options { | 22 namespace options { |
22 | 23 |
23 // Stylus-specific options C++ code. | 24 // Stylus-specific options C++ code. |
24 class OptionsStylusHandler : public ::options::OptionsPageUIHandler, | 25 class OptionsStylusHandler : public ::options::OptionsPageUIHandler, |
25 public NoteTakingHelper::Observer { | 26 public NoteTakingHelper::Observer, |
| 27 public ui::InputDeviceEventObserver { |
26 public: | 28 public: |
27 OptionsStylusHandler(); | 29 OptionsStylusHandler(); |
28 ~OptionsStylusHandler() override; | 30 ~OptionsStylusHandler() override; |
29 | 31 |
30 // OptionsPageUIHandler implementation. | 32 // OptionsPageUIHandler implementation. |
31 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 33 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
32 void InitializePage() override; | 34 void InitializePage() override; |
33 void RegisterMessages() override; | 35 void RegisterMessages() override; |
34 | 36 |
35 // NoteTakingHelper::Observer implementation. | 37 // NoteTakingHelper::Observer implementation. |
36 void OnAvailableNoteTakingAppsUpdated() override; | 38 void OnAvailableNoteTakingAppsUpdated() override; |
37 | 39 |
| 40 // ui::InputDeviceEventObserver implementation: |
| 41 void OnDeviceListsComplete() override; |
| 42 |
38 private: | 43 private: |
| 44 // Called from WebUI when the page is initialized to determine if stylus |
| 45 // settings should be shown. |
| 46 void RequestStylusHardwareState(const base::ListValue* args); |
| 47 |
| 48 // Sends if there is a stylus device to WebUI. |
| 49 void SendHasStylus(); |
| 50 |
39 // Updates the note-taking app menu in the stylus overlay to display the | 51 // Updates the note-taking app menu in the stylus overlay to display the |
40 // currently-available set of apps. | 52 // currently-available set of apps. |
41 void UpdateNoteTakingApps(); | 53 void UpdateNoteTakingApps(); |
42 | 54 |
43 // Called from WebUI when the user selects a note-taking app. | 55 // Called from WebUI when the user selects a note-taking app. |
44 void SetPreferredNoteTakingApp(const base::ListValue* args); | 56 void SetPreferredNoteTakingApp(const base::ListValue* args); |
45 | 57 |
46 // IDs of available note-taking apps. | 58 // IDs of available note-taking apps. |
47 std::set<std::string> note_taking_app_ids_; | 59 std::set<std::string> note_taking_app_ids_; |
48 | 60 |
49 base::WeakPtrFactory<OptionsStylusHandler> weak_ptr_factory_; | 61 base::WeakPtrFactory<OptionsStylusHandler> weak_ptr_factory_; |
50 | 62 |
51 DISALLOW_COPY_AND_ASSIGN(OptionsStylusHandler); | 63 DISALLOW_COPY_AND_ASSIGN(OptionsStylusHandler); |
52 }; | 64 }; |
53 | 65 |
54 } // namespace options | 66 } // namespace options |
55 } // namespace chromeos | 67 } // namespace chromeos |
56 | 68 |
57 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_OPTIONS_STYLUS_HANDLER_H_ | 69 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_OPTIONS_STYLUS_HANDLER_H_ |
OLD | NEW |