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

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

Powered by Google App Engine
This is Rietveld 408576698