| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 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 virtual ~EchoPrivateGetOobeTimestampFunction(); | 48 virtual ~EchoPrivateGetOobeTimestampFunction(); |
| 49 virtual bool RunImpl() OVERRIDE; | 49 virtual 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 ChromeSyncExtensionFunction { |
| 58 public: | 58 public: |
| 59 EchoPrivateSetOfferInfoFunction(); | 59 EchoPrivateSetOfferInfoFunction(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 EchoPrivateGetUserConsentFunction(); | 95 EchoPrivateGetUserConsentFunction(); |
| 96 | 96 |
| 97 // Creates the function with non-null dialog_shown_callback_. | 97 // Creates the function with non-null dialog_shown_callback_. |
| 98 // To be used in tests. | 98 // To be used in tests. |
| 99 static scoped_refptr<EchoPrivateGetUserConsentFunction> CreateForTest( | 99 static scoped_refptr<EchoPrivateGetUserConsentFunction> CreateForTest( |
| 100 const DialogShownTestCallback& dialog_shown_callback); | 100 const DialogShownTestCallback& dialog_shown_callback); |
| 101 | 101 |
| 102 protected: | 102 protected: |
| 103 virtual ~EchoPrivateGetUserConsentFunction(); | 103 virtual ~EchoPrivateGetUserConsentFunction(); |
| 104 | 104 |
| 105 virtual bool RunImpl() OVERRIDE; | 105 virtual bool RunAsync() OVERRIDE; |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 // chromeos::EchoDialogListener overrides. | 108 // chromeos::EchoDialogListener overrides. |
| 109 virtual void OnAccept() OVERRIDE; | 109 virtual void OnAccept() OVERRIDE; |
| 110 virtual void OnCancel() OVERRIDE; | 110 virtual void OnCancel() OVERRIDE; |
| 111 virtual void OnMoreInfoLinkClicked() OVERRIDE; | 111 virtual void OnMoreInfoLinkClicked() OVERRIDE; |
| 112 | 112 |
| 113 // Checks whether "allow redeem ChromeOS registration offers" setting is | 113 // Checks whether "allow redeem ChromeOS registration offers" setting is |
| 114 // disabled in cros settings. It may be asynchronous if the needed settings | 114 // disabled in cros settings. It may be asynchronous if the needed settings |
| 115 // provider is not yet trusted. | 115 // provider is not yet trusted. |
| 116 // Upon completion |OnRedeemOffersAllowed| is called. | 116 // Upon completion |OnRedeemOffersAllowed| is called. |
| 117 void CheckRedeemOffersAllowed(); | 117 void CheckRedeemOffersAllowed(); |
| 118 void OnRedeemOffersAllowedChecked(bool is_allowed); | 118 void OnRedeemOffersAllowedChecked(bool is_allowed); |
| 119 | 119 |
| 120 // Sets result and calls SendResponse. | 120 // Sets result and calls SendResponse. |
| 121 void Finalize(bool consent); | 121 void Finalize(bool consent); |
| 122 | 122 |
| 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 |