| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/extensions/blob_reader.h" | 13 #include "chrome/browser/extensions/blob_reader.h" |
| 14 #include "chrome/browser/feedback/feedback_data.h" | |
| 15 #include "chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.h" | 14 #include "chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.h" |
| 16 #include "chrome/common/extensions/api/feedback_private.h" | 15 #include "chrome/common/extensions/api/feedback_private.h" |
| 16 #include "components/feedback/feedback_data.h" |
| 17 | 17 |
| 18 class Profile; | 18 class Profile; |
| 19 | 19 |
| 20 using extensions::api::feedback_private::SystemInformation; | 20 using extensions::api::feedback_private::SystemInformation; |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 | 23 |
| 24 typedef std::vector<linked_ptr<SystemInformation> > SystemInformationList; | 24 typedef std::vector<linked_ptr<SystemInformation> > SystemInformationList; |
| 25 | 25 |
| 26 class FeedbackService { | 26 class FeedbackService { |
| 27 public: | 27 public: |
| 28 typedef base::Callback<void(bool)> SendFeedbackCallback; | 28 typedef base::Callback<void(bool)> SendFeedbackCallback; |
| 29 typedef base::Callback<void(const SystemInformationList& sys_info)> | 29 typedef base::Callback<void(const SystemInformationList& sys_info)> |
| 30 GetSystemInformationCallback; | 30 GetSystemInformationCallback; |
| 31 | 31 |
| 32 // Creates a platform-specific FeedbackService instance. | 32 // Creates a platform-specific FeedbackService instance. |
| 33 static FeedbackService* CreateInstance(); | 33 static FeedbackService* CreateInstance(); |
| 34 | 34 |
| 35 virtual ~FeedbackService(); | 35 virtual ~FeedbackService(); |
| 36 | 36 |
| 37 // Sends a feedback report. | 37 // Sends a feedback report. |
| 38 void SendFeedback(Profile* profile, | 38 void SendFeedback(Profile* profile, |
| 39 scoped_refptr<FeedbackData> feedback_data, | 39 scoped_refptr<feedback::FeedbackData> feedback_data, |
| 40 const SendFeedbackCallback& callback); | 40 const SendFeedbackCallback& callback); |
| 41 | 41 |
| 42 // Start to gather system information. | 42 // Start to gather system information. |
| 43 // The |callback| will be invoked once the query is completed. | 43 // The |callback| will be invoked once the query is completed. |
| 44 void GetSystemInformation(const GetSystemInformationCallback& callback); | 44 void GetSystemInformation(const GetSystemInformationCallback& callback); |
| 45 | 45 |
| 46 // Platform specific methods: | 46 // Platform specific methods: |
| 47 // Gets the email address of the logged in user. | 47 // Gets the email address of the logged in user. |
| 48 virtual std::string GetUserEmail() = 0; | 48 virtual std::string GetUserEmail() = 0; |
| 49 | 49 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 66 // data object once all the requisite data has been populated. | 66 // data object once all the requisite data has been populated. |
| 67 void CompleteSendFeedback(); | 67 void CompleteSendFeedback(); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 void OnSystemLogsFetchComplete( | 70 void OnSystemLogsFetchComplete( |
| 71 scoped_ptr<system_logs::SystemLogsResponse> sys_info); | 71 scoped_ptr<system_logs::SystemLogsResponse> sys_info); |
| 72 | 72 |
| 73 GetSystemInformationCallback system_information_callback_; | 73 GetSystemInformationCallback system_information_callback_; |
| 74 SendFeedbackCallback send_feedback_callback_; | 74 SendFeedbackCallback send_feedback_callback_; |
| 75 | 75 |
| 76 scoped_refptr<FeedbackData> feedback_data_; | 76 scoped_refptr<feedback::FeedbackData> feedback_data_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(FeedbackService); | 78 DISALLOW_COPY_AND_ASSIGN(FeedbackService); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace extensions | 81 } // namespace extensions |
| 82 | 82 |
| 83 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ | 83 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ |
| OLD | NEW |