| 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_RLZ_RLZ_EXTENSION_API_H_ | 5 #ifndef CHROME_BROWSER_RLZ_RLZ_EXTENSION_API_H_ |
| 6 #define CHROME_BROWSER_RLZ_RLZ_EXTENSION_API_H_ | 6 #define CHROME_BROWSER_RLZ_RLZ_EXTENSION_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #if defined(OS_WIN) || defined(OS_MACOSX) | 11 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 12 | 12 |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/extensions/extension_function.h" | 14 #include "chrome/browser/extensions/extension_function.h" |
| 15 #include "rlz/lib/lib_values.h" | 15 #include "rlz/lib/lib_values.h" |
| 16 | 16 |
| 17 class RlzRecordProductEventFunction : public SyncExtensionFunction { | 17 class RlzRecordProductEventFunction : public SyncExtensionFunction { |
| 18 public: |
| 19 DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.recordProductEvent") |
| 20 |
| 21 protected: |
| 22 virtual ~RlzRecordProductEventFunction() {} |
| 23 |
| 24 // ExtensionFunction: |
| 18 virtual bool RunImpl() OVERRIDE; | 25 virtual bool RunImpl() OVERRIDE; |
| 19 DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.recordProductEvent") | |
| 20 }; | 26 }; |
| 21 | 27 |
| 22 class RlzGetAccessPointRlzFunction : public SyncExtensionFunction { | 28 class RlzGetAccessPointRlzFunction : public SyncExtensionFunction { |
| 29 public: |
| 30 DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.getAccessPointRlz") |
| 31 |
| 32 protected: |
| 33 virtual ~RlzGetAccessPointRlzFunction() {} |
| 34 |
| 35 // ExtensionFunction: |
| 23 virtual bool RunImpl() OVERRIDE; | 36 virtual bool RunImpl() OVERRIDE; |
| 24 DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.getAccessPointRlz") | |
| 25 }; | 37 }; |
| 26 | 38 |
| 27 class RlzSendFinancialPingFunction : public AsyncExtensionFunction { | 39 class RlzSendFinancialPingFunction : public AsyncExtensionFunction { |
| 28 public: | 40 public: |
| 41 DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.sendFinancialPing") |
| 42 |
| 29 RlzSendFinancialPingFunction(); | 43 RlzSendFinancialPingFunction(); |
| 44 |
| 45 protected: |
| 46 friend class MockRlzSendFinancialPingFunction; |
| 30 virtual ~RlzSendFinancialPingFunction(); | 47 virtual ~RlzSendFinancialPingFunction(); |
| 31 | 48 |
| 32 DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.sendFinancialPing") | 49 // ExtensionFunction: |
| 33 // Making this function protected so that it can be overridden in tests. | |
| 34 protected: | |
| 35 virtual bool RunImpl() OVERRIDE; | 50 virtual bool RunImpl() OVERRIDE; |
| 36 | 51 |
| 37 private: | 52 private: |
| 38 void WorkOnWorkerThread(); | 53 void WorkOnWorkerThread(); |
| 39 void RespondOnUIThread(); | 54 void RespondOnUIThread(); |
| 40 | 55 |
| 41 rlz_lib::Product product_; | 56 rlz_lib::Product product_; |
| 42 scoped_array<rlz_lib::AccessPoint> access_points_; | 57 scoped_array<rlz_lib::AccessPoint> access_points_; |
| 43 std::string signature_; | 58 std::string signature_; |
| 44 std::string brand_; | 59 std::string brand_; |
| 45 std::string id_; | 60 std::string id_; |
| 46 std::string lang_; | 61 std::string lang_; |
| 47 bool exclude_machine_id_; | 62 bool exclude_machine_id_; |
| 48 }; | 63 }; |
| 49 | 64 |
| 50 class RlzClearProductStateFunction : public SyncExtensionFunction { | 65 class RlzClearProductStateFunction : public SyncExtensionFunction { |
| 66 public: |
| 67 DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.clearProductState") |
| 68 |
| 69 protected: |
| 70 virtual ~RlzClearProductStateFunction() {} |
| 71 |
| 72 // ExtensionFunction: |
| 51 virtual bool RunImpl() OVERRIDE; | 73 virtual bool RunImpl() OVERRIDE; |
| 52 DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.clearProductState") | |
| 53 }; | 74 }; |
| 54 | 75 |
| 55 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 76 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 56 | 77 |
| 57 #endif // CHROME_BROWSER_RLZ_RLZ_EXTENSION_API_H_ | 78 #endif // CHROME_BROWSER_RLZ_RLZ_EXTENSION_API_H_ |
| OLD | NEW |