| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/socket/socket_api.h" | 5 #include "chrome/browser/extensions/api/socket/socket_api.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const int kWildcardPort = 0; | 48 const int kWildcardPort = 0; |
| 49 | 49 |
| 50 SocketAsyncApiFunction::SocketAsyncApiFunction() { | 50 SocketAsyncApiFunction::SocketAsyncApiFunction() { |
| 51 } | 51 } |
| 52 | 52 |
| 53 SocketAsyncApiFunction::~SocketAsyncApiFunction() { | 53 SocketAsyncApiFunction::~SocketAsyncApiFunction() { |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool SocketAsyncApiFunction::PrePrepare() { | 56 bool SocketAsyncApiFunction::PrePrepare() { |
| 57 manager_ = CreateSocketResourceManager(); | 57 manager_ = CreateSocketResourceManager(); |
| 58 return manager_->SetProfile(GetProfile()); | 58 return manager_->SetBrowserContext(context()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool SocketAsyncApiFunction::Respond() { | 61 bool SocketAsyncApiFunction::Respond() { |
| 62 return error_.empty(); | 62 return error_.empty(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 scoped_ptr<SocketResourceManagerInterface> | 65 scoped_ptr<SocketResourceManagerInterface> |
| 66 SocketAsyncApiFunction::CreateSocketResourceManager() { | 66 SocketAsyncApiFunction::CreateSocketResourceManager() { |
| 67 return scoped_ptr<SocketResourceManagerInterface>( | 67 return scoped_ptr<SocketResourceManagerInterface>( |
| 68 new SocketResourceManager<Socket>()).Pass(); | 68 new SocketResourceManager<Socket>()).Pass(); |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 return; | 891 return; |
| 892 } | 892 } |
| 893 | 893 |
| 894 base::ListValue* values = new base::ListValue(); | 894 base::ListValue* values = new base::ListValue(); |
| 895 values->AppendStrings((std::vector<std::string>&) | 895 values->AppendStrings((std::vector<std::string>&) |
| 896 static_cast<UDPSocket*>(socket)->GetJoinedGroups()); | 896 static_cast<UDPSocket*>(socket)->GetJoinedGroups()); |
| 897 SetResult(values); | 897 SetResult(values); |
| 898 } | 898 } |
| 899 | 899 |
| 900 } // namespace extensions | 900 } // namespace extensions |
| OLD | NEW |