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

Side by Side Diff: remoting/host/native_messaging/log_message_handler.h

Issue 1272833002: Pass error messages from native messaging to web-app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added IT2Me support. Created 5 years, 4 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 (c) 2015 The Chromium Authors. All rights reserved.
Sergey Ulanov 2015/08/16 23:22:02 nit: remove (c)
Jamie 2015/08/17 17:32:24 Done.
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 REMOTING_HOST_NATIVE_MESSAGIN_LOG_HANDLER_H_
6 #define REMOTING_HOST_NATIVE_MESSAGIN_LOG_HANDLER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/values.h"
11
12 namespace remoting {
13
14 // Helper class for logging::SetLogMessageHandler to deliver log messages to
15 // a consistent thread in a thread-safe way and in a format suitable for sending
16 // over a Native Messaging channel.
17 class LogMessageHandler {
18 public:
19 typedef base::Callback<void (scoped_ptr<base::Value> message)> Delegate;
Jamie 2015/08/11 21:23:13 This is only ever passed a DictionaryValue, but gi
20
21 explicit LogMessageHandler(const Delegate& delegate);
22 ~LogMessageHandler();
23
24 private:
25 static bool OnLogMessage(
26 int severity, const char* file, int line,
27 size_t message_start, const std::string& str);
28 void PostLogMessageToCorrectThread(
29 int severity, const char* file, int line,
30 size_t message_start, const std::string& str);
31 void SendLogMessageToClient(
32 int severity, const char* file, int line,
33 size_t message_start, const std::string& str);
34
35 Delegate delegate_;
36 bool suppress_logging_;
37 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
38 logging::LogMessageHandlerFunction previous_log_message_handler_;
39 base::WeakPtrFactory<LogMessageHandler> weak_ptr_factory_;
40 };
41
42 } // namespace remoting
43
44 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698