OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_ |
| 7 |
| 8 #include "chrome/browser/extensions/api/feedback_private/feedback_service.h" |
| 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
| 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 #include "chrome/common/extensions/api/feedback_private.h" |
| 12 |
| 13 namespace extensions { |
| 14 |
| 15 class FeedbackService; |
| 16 |
| 17 class FeedbackPrivateAPI : public ProfileKeyedAPI { |
| 18 public: |
| 19 explicit FeedbackPrivateAPI(Profile* profile); |
| 20 virtual ~FeedbackPrivateAPI(); |
| 21 |
| 22 FeedbackService* GetService() const; |
| 23 void RequestFeedback(const std::string& description_template, |
| 24 const std::string& category_tag, |
| 25 const GURL& page_url); |
| 26 |
| 27 // ProfileKeyedAPI implementation. |
| 28 static ProfileKeyedAPIFactory<FeedbackPrivateAPI>* GetFactoryInstance(); |
| 29 |
| 30 private: |
| 31 friend class ProfileKeyedAPIFactory<FeedbackPrivateAPI>; |
| 32 |
| 33 // ProfileKeyedAPI implementation. |
| 34 static const char* service_name() { |
| 35 return "FeedbackPrivateAPI"; |
| 36 } |
| 37 |
| 38 Profile* const profile_; |
| 39 FeedbackService* service_; |
| 40 }; |
| 41 |
| 42 class FeedbackPrivateGetUserEmailFunction : public SyncExtensionFunction { |
| 43 public: |
| 44 DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getUserEmail", |
| 45 FEEDBACKPRIVATE_GETUSEREMAIL); |
| 46 |
| 47 protected: |
| 48 virtual ~FeedbackPrivateGetUserEmailFunction() {} |
| 49 virtual bool RunImpl() OVERRIDE; |
| 50 }; |
| 51 |
| 52 class FeedbackPrivateGetSystemInformationFunction |
| 53 : public AsyncExtensionFunction { |
| 54 public: |
| 55 DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getSystemInformation", |
| 56 FEEDBACKPRIVATE_GETSYSTEMINFORMATION); |
| 57 |
| 58 protected: |
| 59 virtual ~FeedbackPrivateGetSystemInformationFunction() {} |
| 60 virtual bool RunImpl() OVERRIDE; |
| 61 |
| 62 private: |
| 63 void OnCompleted(const SystemInformationList& sys_info); |
| 64 }; |
| 65 |
| 66 class FeedbackPrivateSendFeedbackFunction : public AsyncExtensionFunction { |
| 67 public: |
| 68 DECLARE_EXTENSION_FUNCTION("feedbackPrivate.sendFeedback", |
| 69 FEEDBACKPRIVATE_SENDFEEDBACK); |
| 70 |
| 71 protected: |
| 72 virtual ~FeedbackPrivateSendFeedbackFunction() {} |
| 73 virtual bool RunImpl() OVERRIDE; |
| 74 |
| 75 private: |
| 76 void OnCompleted(bool success); |
| 77 }; |
| 78 |
| 79 } // namespace extensions |
| 80 |
| 81 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H
_ |
OLD | NEW |