OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_LOG_SOURCE_RESOURCE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_LOG_SOURCE_RESOURCE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_LOG_SOURCE_RESOURCE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_LOG_SOURCE_RESOURCE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "chrome/browser/chromeos/system_logs/single_log_source.h" | |
13 #include "chrome/browser/extensions/api/feedback_private/log_source_access_manag
er.h" | 12 #include "chrome/browser/extensions/api/feedback_private/log_source_access_manag
er.h" |
| 13 #include "chrome/browser/feedback/system_logs/system_logs_fetcher.h" |
14 #include "extensions/browser/api/api_resource.h" | 14 #include "extensions/browser/api/api_resource.h" |
15 #include "extensions/browser/api/api_resource_manager.h" | 15 #include "extensions/browser/api/api_resource_manager.h" |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 // Holds a SingleLogSource object that is used by an extension using the | 19 // Holds a SystemLogsSource object that is used by an extension using the |
20 // feedbackPrivate API. | 20 // feedbackPrivate API. |
21 class LogSourceResource : public ApiResource { | 21 class LogSourceResource : public ApiResource { |
22 public: | 22 public: |
23 static const content::BrowserThread::ID kThreadId = | 23 static const content::BrowserThread::ID kThreadId = |
24 content::BrowserThread::UI; | 24 content::BrowserThread::UI; |
25 | 25 |
26 LogSourceResource(const std::string& extension_id, | 26 LogSourceResource(const std::string& extension_id, |
27 std::unique_ptr<system_logs::SingleLogSource> source, | 27 std::unique_ptr<system_logs::SystemLogsSource> source, |
28 base::Closure unregister_callback_); | 28 base::Closure unregister_callback_); |
29 | 29 |
30 ~LogSourceResource() override; | 30 ~LogSourceResource() override; |
31 | 31 |
32 system_logs::SingleLogSource* GetLogSource() const { return source_.get(); } | 32 system_logs::SystemLogsSource* GetLogSource() const { return source_.get(); } |
33 | 33 |
34 private: | 34 private: |
35 friend class ApiResourceManager<LogSourceResource>; | 35 friend class ApiResourceManager<LogSourceResource>; |
36 static const char* service_name() { return "LogSourceResource"; } | 36 static const char* service_name() { return "LogSourceResource"; } |
37 | 37 |
38 std::unique_ptr<system_logs::SingleLogSource> source_; | 38 std::unique_ptr<system_logs::SystemLogsSource> source_; |
39 | 39 |
40 // This unregisters the LogSourceResource from a LogSourceAccessManager when | 40 // This unregisters the LogSourceResource from a LogSourceAccessManager when |
41 // this resource is cleaned up. Just pass in a base::Closure to the | 41 // this resource is cleaned up. Just pass in a base::Closure to the |
42 // constructor. | 42 // constructor. |
43 base::ScopedClosureRunner unregister_runner_; | 43 base::ScopedClosureRunner unregister_runner_; |
44 | 44 |
45 DISALLOW_COPY_AND_ASSIGN(LogSourceResource); | 45 DISALLOW_COPY_AND_ASSIGN(LogSourceResource); |
46 }; | 46 }; |
47 | 47 |
48 } // namespace extensions | 48 } // namespace extensions |
49 | 49 |
50 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_LOG_SOURCE_RESOURCE_H_ | 50 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_LOG_SOURCE_RESOURCE_H_ |
OLD | NEW |