| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 EXTENSIONS_BROWSER_API_LOCK_SCREEN_DATA_LOCK_SCREEN_DATA_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_LOCK_SCREEN_DATA_LOCK_SCREEN_DATA_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_LOCK_SCREEN_DATA_LOCK_SCREEN_DATA_API_H_ | 6 #define EXTENSIONS_BROWSER_API_LOCK_SCREEN_DATA_LOCK_SCREEN_DATA_API_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 #include <vector> |
| 10 |
| 8 #include "base/macros.h" | 11 #include "base/macros.h" |
| 9 #include "extensions/browser/extension_function.h" | 12 #include "extensions/browser/extension_function.h" |
| 10 | 13 |
| 11 namespace extensions { | 14 namespace extensions { |
| 12 | 15 |
| 16 namespace lock_screen_data { |
| 17 enum class OperationResult; |
| 18 class DataItem; |
| 19 } // namespace lock_screen_data |
| 20 |
| 13 class LockScreenDataCreateFunction : public UIThreadExtensionFunction { | 21 class LockScreenDataCreateFunction : public UIThreadExtensionFunction { |
| 14 public: | 22 public: |
| 15 LockScreenDataCreateFunction(); | 23 LockScreenDataCreateFunction(); |
| 16 | 24 |
| 17 private: | 25 private: |
| 18 ~LockScreenDataCreateFunction() override; | 26 ~LockScreenDataCreateFunction() override; |
| 19 | 27 |
| 20 ResponseAction Run() override; | 28 ResponseAction Run() override; |
| 21 | 29 |
| 30 void OnDone(lock_screen_data::OperationResult result, |
| 31 const lock_screen_data::DataItem* item); |
| 32 |
| 22 DECLARE_EXTENSION_FUNCTION("lockScreen.data.create", LOCKSCREENDATA_CREATE); | 33 DECLARE_EXTENSION_FUNCTION("lockScreen.data.create", LOCKSCREENDATA_CREATE); |
| 23 DISALLOW_COPY_AND_ASSIGN(LockScreenDataCreateFunction); | 34 DISALLOW_COPY_AND_ASSIGN(LockScreenDataCreateFunction); |
| 24 }; | 35 }; |
| 25 | 36 |
| 26 class LockScreenDataGetAllFunction : public UIThreadExtensionFunction { | 37 class LockScreenDataGetAllFunction : public UIThreadExtensionFunction { |
| 27 public: | 38 public: |
| 28 LockScreenDataGetAllFunction(); | 39 LockScreenDataGetAllFunction(); |
| 29 | 40 |
| 30 private: | 41 private: |
| 31 ~LockScreenDataGetAllFunction() override; | 42 ~LockScreenDataGetAllFunction() override; |
| 32 | 43 |
| 33 ResponseAction Run() override; | 44 ResponseAction Run() override; |
| 34 | 45 |
| 46 void OnDone(const std::vector<const lock_screen_data::DataItem*>& items); |
| 47 |
| 35 DECLARE_EXTENSION_FUNCTION("lockScreen.data.getAll", LOCKSCREENDATA_GETALL); | 48 DECLARE_EXTENSION_FUNCTION("lockScreen.data.getAll", LOCKSCREENDATA_GETALL); |
| 36 DISALLOW_COPY_AND_ASSIGN(LockScreenDataGetAllFunction); | 49 DISALLOW_COPY_AND_ASSIGN(LockScreenDataGetAllFunction); |
| 37 }; | 50 }; |
| 38 | 51 |
| 39 class LockScreenDataGetContentFunction : public UIThreadExtensionFunction { | 52 class LockScreenDataGetContentFunction : public UIThreadExtensionFunction { |
| 40 public: | 53 public: |
| 41 LockScreenDataGetContentFunction(); | 54 LockScreenDataGetContentFunction(); |
| 42 | 55 |
| 43 private: | 56 private: |
| 44 ~LockScreenDataGetContentFunction() override; | 57 ~LockScreenDataGetContentFunction() override; |
| 45 | 58 |
| 46 ResponseAction Run() override; | 59 ResponseAction Run() override; |
| 47 | 60 |
| 61 void OnDone(lock_screen_data::OperationResult result, |
| 62 std::unique_ptr<std::vector<char>> data); |
| 63 |
| 48 DECLARE_EXTENSION_FUNCTION("lockScreen.data.getContent", | 64 DECLARE_EXTENSION_FUNCTION("lockScreen.data.getContent", |
| 49 LOCKSCREENDATA_GETCONTENT); | 65 LOCKSCREENDATA_GETCONTENT); |
| 50 DISALLOW_COPY_AND_ASSIGN(LockScreenDataGetContentFunction); | 66 DISALLOW_COPY_AND_ASSIGN(LockScreenDataGetContentFunction); |
| 51 }; | 67 }; |
| 52 | 68 |
| 53 class LockScreenDataSetContentFunction : public UIThreadExtensionFunction { | 69 class LockScreenDataSetContentFunction : public UIThreadExtensionFunction { |
| 54 public: | 70 public: |
| 55 LockScreenDataSetContentFunction(); | 71 LockScreenDataSetContentFunction(); |
| 56 | 72 |
| 57 private: | 73 private: |
| 58 ~LockScreenDataSetContentFunction() override; | 74 ~LockScreenDataSetContentFunction() override; |
| 59 | 75 |
| 60 ResponseAction Run() override; | 76 ResponseAction Run() override; |
| 61 | 77 |
| 78 void OnDone(lock_screen_data::OperationResult result); |
| 79 |
| 62 DECLARE_EXTENSION_FUNCTION("lockScreen.data.setContent", | 80 DECLARE_EXTENSION_FUNCTION("lockScreen.data.setContent", |
| 63 LOCKSCREENDATA_SETCONTENT); | 81 LOCKSCREENDATA_SETCONTENT); |
| 64 DISALLOW_COPY_AND_ASSIGN(LockScreenDataSetContentFunction); | 82 DISALLOW_COPY_AND_ASSIGN(LockScreenDataSetContentFunction); |
| 65 }; | 83 }; |
| 66 | 84 |
| 67 class LockScreenDataDeleteFunction : public UIThreadExtensionFunction { | 85 class LockScreenDataDeleteFunction : public UIThreadExtensionFunction { |
| 68 public: | 86 public: |
| 69 LockScreenDataDeleteFunction(); | 87 LockScreenDataDeleteFunction(); |
| 70 | 88 |
| 71 private: | 89 private: |
| 72 ~LockScreenDataDeleteFunction() override; | 90 ~LockScreenDataDeleteFunction() override; |
| 73 | 91 |
| 74 ResponseAction Run() override; | 92 ResponseAction Run() override; |
| 75 | 93 |
| 94 void OnDone(lock_screen_data::OperationResult result); |
| 95 |
| 76 DECLARE_EXTENSION_FUNCTION("lockScreen.data.delete", LOCKSCREENDATA_DELETE); | 96 DECLARE_EXTENSION_FUNCTION("lockScreen.data.delete", LOCKSCREENDATA_DELETE); |
| 77 | 97 |
| 78 DISALLOW_COPY_AND_ASSIGN(LockScreenDataDeleteFunction); | 98 DISALLOW_COPY_AND_ASSIGN(LockScreenDataDeleteFunction); |
| 79 }; | 99 }; |
| 80 | 100 |
| 81 } // namespace extensions | 101 } // namespace extensions |
| 82 | 102 |
| 83 #endif // EXTENSIONS_BROWSER_API_LOCK_SCREEN_DATA_LOCK_SCREEN_DATA_API_H_ | 103 #endif // EXTENSIONS_BROWSER_API_LOCK_SCREEN_DATA_LOCK_SCREEN_DATA_API_H_ |
| OLD | NEW |