Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/extensions/api/copresence_private/copresence_private_api.cc

Issue 1828683002: [Extensions] Convert APIs to use movable types [3] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Antony's Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/copresence/copresence_translations.cc ('k') | chrome/common/extensions/api/browser.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698