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_SERVICE_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ | |
7 | |
8 #include <vector> | |
9 #include "base/basictypes.h" | |
10 #include "base/callback.h" | |
11 #include "base/memory/linked_ptr.h" | |
12 #include "base/memory/weak_ptr.h" | |
13 #include "chrome/browser/extensions/api/feedback_private/blob_reader.h" | |
14 #include "chrome/browser/feedback/feedback_data.h" | |
15 #include "chrome/common/extensions/api/feedback_private.h" | |
16 | |
17 class Profile; | |
18 | |
19 namespace extensions { | |
20 | |
21 typedef std::vector<linked_ptr<api::feedback_private::SystemInformation> > | |
22 SystemInformationList; | |
23 | |
24 class FeedbackService { | |
25 public: | |
26 typedef base::Callback<void(bool)> SendFeedbackCallback; | |
27 typedef base::Callback<void(const SystemInformationList& sys_info)> | |
28 GetSystemInformationCallback; | |
29 | |
30 // Creates a platform-specific FeedbackService instance. | |
31 static FeedbackService* CreateInstance(); | |
32 | |
33 virtual ~FeedbackService() {} | |
34 | |
35 // Sends a feedback report. | |
36 virtual void SendFeedback(Profile* profile, | |
37 scoped_refptr<FeedbackData> feedback_data, | |
38 const SendFeedbackCallback& callback); | |
39 | |
40 // Platform specific methods: | |
41 // Get's the email address of the logged in user. | |
42 virtual std::string GetUserEmail() = 0; | |
43 // Start to gather system information. | |
asargent_no_longer_on_chrome
2013/06/17 19:32:40
nit: a blank line before line 43 would aid readabi
rkc
2013/06/17 21:48:19
Done.
| |
44 // The |callback| will be invoked once the query is completed. | |
45 virtual void GetSystemInformation( | |
46 const GetSystemInformationCallback& callback) = 0; | |
47 | |
48 protected: | |
49 FeedbackService() {} | |
50 | |
51 // Used to get a weak ptr for a derived class instance. | |
52 virtual base::WeakPtr<FeedbackService> GetWeakPtr() = 0; | |
asargent_no_longer_on_chrome
2013/06/17 19:32:40
nit: can you just extend SupportsWeakPtr to get th
rkc
2013/06/17 21:48:19
So we can't really have FeedbackService : SupportW
asargent_no_longer_on_chrome
2013/06/17 22:12:58
Ok.
| |
53 | |
54 // Callbacks to receive blob data. | |
55 void AttachedFileCallback(scoped_ptr<std::string> data); | |
56 void ScreenshotCallback(scoped_ptr<std::string> data); | |
57 | |
58 // Checks if we have read all the blobs we need to; signals the feedback | |
59 // data object once all the requisite data has been populated. | |
60 void CompleteSendFeedback(); | |
61 | |
62 GetSystemInformationCallback system_information_callback_; | |
63 SendFeedbackCallback send_feedback_callback_; | |
64 | |
65 scoped_refptr<FeedbackData> feedback_data_; | |
66 BlobReader* attached_file_reader_; | |
67 BlobReader* screenshot_reader_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(FeedbackService); | |
70 }; | |
71 | |
72 } // namespace extensions | |
73 | |
74 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_ | |
OLD | NEW |