Chromium Code Reviews| Index: extensions/browser/api/cast_channel/cast_channel_api.cc |
| diff --git a/extensions/browser/api/cast_channel/cast_channel_api.cc b/extensions/browser/api/cast_channel/cast_channel_api.cc |
| index e992a49a16ba57cf2ad7243c006b840ea9c86681..adcfe4d87fe590fa2f4541c46cf24079c489068b 100644 |
| --- a/extensions/browser/api/cast_channel/cast_channel_api.cc |
| +++ b/extensions/browser/api/cast_channel/cast_channel_api.cc |
| @@ -453,4 +453,36 @@ void CastChannelCloseFunction::OnClose(int result) { |
| AsyncWorkCompleted(); |
| } |
| +CastChannelGetLogsFunction::CastChannelGetLogsFunction() { |
| +} |
| + |
| +CastChannelGetLogsFunction::~CastChannelGetLogsFunction() { |
| +} |
| + |
| +bool CastChannelGetLogsFunction::PrePrepare() { |
| + api_ = CastChannelAPI::Get(browser_context()); |
| + return CastChannelAsyncApiFunction::PrePrepare(); |
| +} |
| + |
| +bool CastChannelGetLogsFunction::Prepare() { |
| + return true; |
| +} |
| + |
| +void CastChannelGetLogsFunction::AsyncWorkStart() { |
| + DCHECK(api_); |
| + |
| + std::string log; |
| + if (api_->GetLogger()->LogToString(&log)) { |
|
mark a. foltz
2014/08/11 23:01:43
How about having a LogToValue() method that can ha
imcheng
2014/08/12 07:42:09
Yes, that's possible by asking zlib for the compre
|
| + base::BinaryValue* result = |
| + base::BinaryValue::CreateWithCopiedBuffer(&log[0], log.size()); |
|
mark a. foltz
2014/08/11 23:01:43
log.data()
imcheng
2014/08/12 07:42:09
Done.
|
| + SetResult(result); |
| + } else { |
| + SetResult(new base::BinaryValue()); |
|
mark a. foltz
2014/08/11 23:01:43
Does this mean no events were logged? Or is this
imcheng
2014/08/12 07:42:09
If no events is logged then a blob representing an
|
| + } |
| + |
| + api_->GetLogger()->Reset(); |
| + |
| + AsyncWorkCompleted(); |
| +} |
| + |
| } // namespace extensions |