Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: chrome/browser/extensions/api/feedback_private/log_source_resource.h

Issue 2840103002: Add new API function: feedbackPrivate.readLogSource (Closed)
Patch Set: Add proper ifdefs for non-CrOS platforms Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_LOG_SOURCE_RESOURCE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_LOG_SOURCE_RESOURCE_H_
7
8 #include <memory>
9
10 #include "base/callback_helpers.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"
14 #include "extensions/browser/api/api_resource.h"
15 #include "extensions/browser/api/api_resource_manager.h"
16
17 namespace extensions {
18
19 // Holds a SingleLogSource object that is used by an extension using the
20 // feedbackPrivate API.
21 class LogSourceResource : public ApiResource {
22 public:
23 static const content::BrowserThread::ID kThreadId =
24 content::BrowserThread::UI;
25
26 LogSourceResource(const std::string& extension_id,
27 std::unique_ptr<system_logs::SingleLogSource> source,
28 base::Closure unregister_callback_);
29
30 ~LogSourceResource() override;
31
32 system_logs::SingleLogSource* GetLogSource() const { return source_.get(); }
33
34 private:
35 friend class ApiResourceManager<LogSourceResource>;
36 static const char* service_name() { return "LogSourceResource"; }
37
38 std::unique_ptr<system_logs::SingleLogSource> source_;
39
40 // This unregisters the LogSourceResource from a LogSourceAccessManager when
41 // this resource is cleaned up. Just pass in a base::Closure to the
42 // constructor.
43 base::ScopedClosureRunner unregister_runner_;
44
45 DISALLOW_COPY_AND_ASSIGN(LogSourceResource);
46 };
47
48 } // namespace extensions
49
50 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_LOG_SOURCE_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698