| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "extensions/browser/api/cast_channel/cast_socket.h" | 5 #include "extensions/browser/api/cast_channel/cast_socket.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return base::StringPrintf( | 53 return base::StringPrintf( |
| 54 "%04d-%02d-%02d %02d:%02d:%02d.%03d UTC", exploded_time.year, | 54 "%04d-%02d-%02d %02d:%02d:%02d.%03d UTC", exploded_time.year, |
| 55 exploded_time.month, exploded_time.day_of_month, exploded_time.hour, | 55 exploded_time.month, exploded_time.day_of_month, exploded_time.hour, |
| 56 exploded_time.minute, exploded_time.second, exploded_time.millisecond); | 56 exploded_time.minute, exploded_time.second, exploded_time.millisecond); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 namespace extensions { | 61 namespace extensions { |
| 62 static base::LazyInstance<BrowserContextKeyedAPIFactory< | 62 static base::LazyInstance<BrowserContextKeyedAPIFactory< |
| 63 ApiResourceManager<core_api::cast_channel::CastSocket> > > g_factory = | 63 ApiResourceManager<api::cast_channel::CastSocket>>> g_factory = |
| 64 LAZY_INSTANCE_INITIALIZER; | 64 LAZY_INSTANCE_INITIALIZER; |
| 65 | 65 |
| 66 // static | 66 // static |
| 67 template <> | 67 template <> |
| 68 BrowserContextKeyedAPIFactory< | 68 BrowserContextKeyedAPIFactory< |
| 69 ApiResourceManager<core_api::cast_channel::CastSocket> >* | 69 ApiResourceManager<api::cast_channel::CastSocket>>* |
| 70 ApiResourceManager<core_api::cast_channel::CastSocket>::GetFactoryInstance() { | 70 ApiResourceManager<api::cast_channel::CastSocket>::GetFactoryInstance() { |
| 71 return g_factory.Pointer(); | 71 return g_factory.Pointer(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 namespace core_api { | 74 namespace api { |
| 75 namespace cast_channel { | 75 namespace cast_channel { |
| 76 CastSocket::CastSocket(const std::string& owner_extension_id) | 76 CastSocket::CastSocket(const std::string& owner_extension_id) |
| 77 : ApiResource(owner_extension_id) { | 77 : ApiResource(owner_extension_id) { |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool CastSocket::IsPersistent() const { | 80 bool CastSocket::IsPersistent() const { |
| 81 return true; | 81 return true; |
| 82 } | 82 } |
| 83 | 83 |
| 84 CastSocketImpl::CastSocketImpl(const std::string& owner_extension_id, | 84 CastSocketImpl::CastSocketImpl(const std::string& owner_extension_id, |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 } | 590 } |
| 591 | 591 |
| 592 void CastSocketImpl::SetErrorState(ChannelError error_state) { | 592 void CastSocketImpl::SetErrorState(ChannelError error_state) { |
| 593 VLOG_WITH_CONNECTION(1) << "SetErrorState " << error_state; | 593 VLOG_WITH_CONNECTION(1) << "SetErrorState " << error_state; |
| 594 DCHECK_EQ(CHANNEL_ERROR_NONE, error_state_); | 594 DCHECK_EQ(CHANNEL_ERROR_NONE, error_state_); |
| 595 error_state_ = error_state; | 595 error_state_ = error_state; |
| 596 logger_->LogSocketErrorState(channel_id_, ErrorStateToProto(error_state_)); | 596 logger_->LogSocketErrorState(channel_id_, ErrorStateToProto(error_state_)); |
| 597 delegate_->OnError(error_state_); | 597 delegate_->OnError(error_state_); |
| 598 } | 598 } |
| 599 } // namespace cast_channel | 599 } // namespace cast_channel |
| 600 } // namespace core_api | 600 } // namespace api |
| 601 } // namespace extensions | 601 } // namespace extensions |
| 602 #undef VLOG_WITH_CONNECTION | 602 #undef VLOG_WITH_CONNECTION |
| OLD | NEW |