OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/extensions/api/cast_channel/cast_channel_api.h" | 5 #include "chrome/browser/extensions/api/cast_channel/cast_channel_api.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // static | 52 // static |
53 CastChannelAPI* CastChannelAPI::Get(Profile* profile) { | 53 CastChannelAPI* CastChannelAPI::Get(Profile* profile) { |
54 return ProfileKeyedAPIFactory<CastChannelAPI>::GetForProfile(profile); | 54 return ProfileKeyedAPIFactory<CastChannelAPI>::GetForProfile(profile); |
55 } | 55 } |
56 | 56 |
57 static base::LazyInstance<ProfileKeyedAPIFactory<CastChannelAPI> > g_factory = | 57 static base::LazyInstance<ProfileKeyedAPIFactory<CastChannelAPI> > g_factory = |
58 LAZY_INSTANCE_INITIALIZER; | 58 LAZY_INSTANCE_INITIALIZER; |
59 | 59 |
60 // static | 60 // static |
61 ProfileKeyedAPIFactory<CastChannelAPI>* CastChannelAPI::GetFactoryInstance() { | 61 ProfileKeyedAPIFactory<CastChannelAPI>* CastChannelAPI::GetFactoryInstance() { |
62 return &g_factory.Get(); | 62 return g_factory.Pointer(); |
63 } | 63 } |
64 | 64 |
65 scoped_ptr<CastSocket> CastChannelAPI::CreateCastSocket( | 65 scoped_ptr<CastSocket> CastChannelAPI::CreateCastSocket( |
66 const std::string& extension_id, const GURL& url) { | 66 const std::string& extension_id, const GURL& url) { |
67 if (socket_for_test_.get()) { | 67 if (socket_for_test_.get()) { |
68 return socket_for_test_.Pass(); | 68 return socket_for_test_.Pass(); |
69 } else { | 69 } else { |
70 return scoped_ptr<CastSocket>( | 70 return scoped_ptr<CastSocket>( |
71 new CastSocket(extension_id, url, this, | 71 new CastSocket(extension_id, url, this, |
72 g_browser_process->net_log())); | 72 g_browser_process->net_log())); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 SetResultFromError(cast_channel::CHANNEL_ERROR_SOCKET_ERROR); | 263 SetResultFromError(cast_channel::CHANNEL_ERROR_SOCKET_ERROR); |
264 } else { | 264 } else { |
265 int channel_id = params_->channel.channel_id; | 265 int channel_id = params_->channel.channel_id; |
266 SetResultFromSocket(channel_id); | 266 SetResultFromSocket(channel_id); |
267 RemoveSocket(channel_id); | 267 RemoveSocket(channel_id); |
268 } | 268 } |
269 AsyncWorkCompleted(); | 269 AsyncWorkCompleted(); |
270 } | 270 } |
271 | 271 |
272 } // namespace extensions | 272 } // namespace extensions |
OLD | NEW |