OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROMEOS_EXTENSIONS_ECHO_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_ECHO_PRIVATE_API_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_ECHO_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_ECHO_PRIVATE_API_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/chromeos/ui/echo_dialog_listener.h" | 9 #include "chrome/browser/chromeos/ui/echo_dialog_listener.h" |
10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
11 | 11 |
12 class PrefRegistrySimple; | 12 class PrefRegistrySimple; |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 | 15 |
16 class EchoDialogView; | 16 class EchoDialogView; |
17 | 17 |
18 // Namespace to register the EchoCheckedOffers field in Local State. | 18 // Namespace to register the EchoCheckedOffers field in Local State. |
19 namespace echo_offer { | 19 namespace echo_offer { |
20 | 20 |
21 void RegisterPrefs(PrefRegistrySimple* registry); | 21 void RegisterPrefs(PrefRegistrySimple* registry); |
22 | 22 |
23 } // namespace echo_offer | 23 } // namespace echo_offer |
24 | 24 |
25 } // namespace chromeos | 25 } // namespace chromeos |
26 | 26 |
27 class EchoPrivateGetRegistrationCodeFunction | 27 class EchoPrivateGetRegistrationCodeFunction |
28 : public ChromeSyncExtensionFunction { | 28 : public UIThreadExtensionFunction { |
29 public: | 29 public: |
30 EchoPrivateGetRegistrationCodeFunction(); | 30 EchoPrivateGetRegistrationCodeFunction(); |
31 | 31 |
32 protected: | 32 protected: |
33 ~EchoPrivateGetRegistrationCodeFunction() override; | 33 ~EchoPrivateGetRegistrationCodeFunction() override; |
34 bool RunSync() override; | 34 ResponseAction Run() override; |
35 | 35 |
36 private: | 36 private: |
37 void GetRegistrationCode(const std::string& type); | 37 ResponseValue GetRegistrationCode(const std::string& type); |
38 DECLARE_EXTENSION_FUNCTION("echoPrivate.getRegistrationCode", | 38 DECLARE_EXTENSION_FUNCTION("echoPrivate.getRegistrationCode", |
39 ECHOPRIVATE_GETREGISTRATIONCODE) | 39 ECHOPRIVATE_GETREGISTRATIONCODE) |
40 }; | 40 }; |
41 | 41 |
42 class EchoPrivateGetOobeTimestampFunction | 42 class EchoPrivateGetOobeTimestampFunction |
43 : public ChromeAsyncExtensionFunction { | 43 : public ChromeAsyncExtensionFunction { |
44 public: | 44 public: |
45 EchoPrivateGetOobeTimestampFunction(); | 45 EchoPrivateGetOobeTimestampFunction(); |
46 | 46 |
47 protected: | 47 protected: |
48 ~EchoPrivateGetOobeTimestampFunction() override; | 48 ~EchoPrivateGetOobeTimestampFunction() override; |
49 bool RunAsync() override; | 49 bool RunAsync() override; |
50 | 50 |
51 private: | 51 private: |
52 bool GetOobeTimestampOnFileThread(); | 52 bool GetOobeTimestampOnFileThread(); |
53 DECLARE_EXTENSION_FUNCTION("echoPrivate.getOobeTimestamp", | 53 DECLARE_EXTENSION_FUNCTION("echoPrivate.getOobeTimestamp", |
54 ECHOPRIVATE_GETOOBETIMESTAMP) | 54 ECHOPRIVATE_GETOOBETIMESTAMP) |
55 }; | 55 }; |
56 | 56 |
57 class EchoPrivateSetOfferInfoFunction : public ChromeSyncExtensionFunction { | 57 class EchoPrivateSetOfferInfoFunction : public UIThreadExtensionFunction { |
58 public: | 58 public: |
59 EchoPrivateSetOfferInfoFunction(); | 59 EchoPrivateSetOfferInfoFunction(); |
60 | 60 |
61 protected: | 61 protected: |
62 ~EchoPrivateSetOfferInfoFunction() override; | 62 ~EchoPrivateSetOfferInfoFunction() override; |
63 bool RunSync() override; | 63 ResponseAction Run() override; |
64 | 64 |
65 private: | 65 private: |
66 DECLARE_EXTENSION_FUNCTION("echoPrivate.setOfferInfo", | 66 DECLARE_EXTENSION_FUNCTION("echoPrivate.setOfferInfo", |
67 ECHOPRIVATE_SETOFFERINFO) | 67 ECHOPRIVATE_SETOFFERINFO) |
68 }; | 68 }; |
69 | 69 |
70 class EchoPrivateGetOfferInfoFunction : public ChromeSyncExtensionFunction { | 70 class EchoPrivateGetOfferInfoFunction : public UIThreadExtensionFunction { |
71 public: | 71 public: |
72 EchoPrivateGetOfferInfoFunction(); | 72 EchoPrivateGetOfferInfoFunction(); |
73 | 73 |
74 protected: | 74 protected: |
75 ~EchoPrivateGetOfferInfoFunction() override; | 75 ~EchoPrivateGetOfferInfoFunction() override; |
76 bool RunSync() override; | 76 ResponseAction Run() override; |
77 | 77 |
78 private: | 78 private: |
79 DECLARE_EXTENSION_FUNCTION("echoPrivate.getOfferInfo", | 79 DECLARE_EXTENSION_FUNCTION("echoPrivate.getOfferInfo", |
80 ECHOPRIVATE_GETOFFERINFO) | 80 ECHOPRIVATE_GETOFFERINFO) |
81 }; | 81 }; |
82 | 82 |
83 // The function first checks if offers redeeming is allowed by the device | 83 // The function first checks if offers redeeming is allowed by the device |
84 // policy. It should then show a dialog that, depending on the check result, | 84 // policy. It should then show a dialog that, depending on the check result, |
85 // either asks user's consent to verify the device's eligibility for the offer, | 85 // either asks user's consent to verify the device's eligibility for the offer, |
86 // or informs the user that the offers redeeming is disabled. | 86 // or informs the user that the offers redeeming is disabled. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Result of |CheckRedeemOffersAllowed()|. | 123 // Result of |CheckRedeemOffersAllowed()|. |
124 bool redeem_offers_allowed_; | 124 bool redeem_offers_allowed_; |
125 // Callback used in tests. Called after an echo dialog is shown. | 125 // Callback used in tests. Called after an echo dialog is shown. |
126 DialogShownTestCallback dialog_shown_callback_; | 126 DialogShownTestCallback dialog_shown_callback_; |
127 | 127 |
128 DECLARE_EXTENSION_FUNCTION("echoPrivate.getUserConsent", | 128 DECLARE_EXTENSION_FUNCTION("echoPrivate.getUserConsent", |
129 ECHOPRIVATE_GETUSERCONSENT) | 129 ECHOPRIVATE_GETUSERCONSENT) |
130 }; | 130 }; |
131 | 131 |
132 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_ECHO_PRIVATE_API_H_ | 132 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_ECHO_PRIVATE_API_H_ |
OLD | NEW |