| 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 "chrome/browser/extensions/api/copresence_private/copresence_private_ap
i.h" | 5 #include "chrome/browser/extensions/api/copresence_private/copresence_private_ap
i.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 EXTENSION_FUNCTION_VALIDATE(params.get()); | 96 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 97 | 97 |
| 98 WhispernetClient* whispernet_client = | 98 WhispernetClient* whispernet_client = |
| 99 CopresencePrivateService::GetFactoryInstance()->Get(browser_context()) | 99 CopresencePrivateService::GetFactoryInstance()->Get(browser_context()) |
| 100 ->GetWhispernetClient(params->client_id); | 100 ->GetWhispernetClient(params->client_id); |
| 101 if (whispernet_client->GetTokensCallback().is_null()) | 101 if (whispernet_client->GetTokensCallback().is_null()) |
| 102 return RespondNow(NoArguments()); | 102 return RespondNow(NoArguments()); |
| 103 | 103 |
| 104 std::vector<audio_modem::AudioToken> tokens; | 104 std::vector<audio_modem::AudioToken> tokens; |
| 105 for (size_t i = 0; i < params->tokens.size(); ++i) { | 105 for (size_t i = 0; i < params->tokens.size(); ++i) { |
| 106 tokens.push_back(audio_modem::AudioToken(params->tokens[i]->token, | 106 tokens.push_back(audio_modem::AudioToken(params->tokens[i].token, |
| 107 params->tokens[i]->audible)); | 107 params->tokens[i].audible)); |
| 108 } | 108 } |
| 109 whispernet_client->GetTokensCallback().Run(tokens); | 109 whispernet_client->GetTokensCallback().Run(tokens); |
| 110 return RespondNow(NoArguments()); | 110 return RespondNow(NoArguments()); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // CopresenceSendEncodedFunction implementation: | 113 // CopresenceSendEncodedFunction implementation: |
| 114 ExtensionFunction::ResponseAction CopresencePrivateSendSamplesFunction::Run() { | 114 ExtensionFunction::ResponseAction CopresencePrivateSendSamplesFunction::Run() { |
| 115 scoped_ptr<SendSamples::Params> params(SendSamples::Params::Create(*args_)); | 115 scoped_ptr<SendSamples::Params> params(SendSamples::Params::Create(*args_)); |
| 116 EXTENSION_FUNCTION_VALIDATE(params.get()); | 116 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 117 | 117 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 140 SendInitialized::Params::Create(*args_)); | 140 SendInitialized::Params::Create(*args_)); |
| 141 EXTENSION_FUNCTION_VALIDATE(params.get()); | 141 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 142 | 142 |
| 143 CopresencePrivateService::GetFactoryInstance()->Get(browser_context()) | 143 CopresencePrivateService::GetFactoryInstance()->Get(browser_context()) |
| 144 ->OnWhispernetInitialized(params->success); | 144 ->OnWhispernetInitialized(params->success); |
| 145 | 145 |
| 146 return RespondNow(NoArguments()); | 146 return RespondNow(NoArguments()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace extensions | 149 } // namespace extensions |
| OLD | NEW |