OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 // Send events to the appropriate app(s). | 240 // Send events to the appropriate app(s). |
241 for (const auto& app_entry : tokens_by_app) { | 241 for (const auto& app_entry : tokens_by_app) { |
242 const std::string& app_id = app_entry.first; | 242 const std::string& app_id = app_entry.first; |
243 const auto& tokens = app_entry.second; | 243 const auto& tokens = app_entry.second; |
244 if (app_id.empty()) | 244 if (app_id.empty()) |
245 continue; | 245 continue; |
246 | 246 |
247 EventRouter::Get(browser_context_)->DispatchEventToExtension( | 247 EventRouter::Get(browser_context_) |
248 app_id, | 248 ->DispatchEventToExtension( |
249 make_scoped_ptr(new Event(OnReceived::kEventName, | 249 app_id, |
250 OnReceived::Create(tokens)))); | 250 make_scoped_ptr(new Event(events::UNKNOWN, OnReceived::kEventName, |
| 251 OnReceived::Create(tokens)))); |
251 } | 252 } |
252 } | 253 } |
253 | 254 |
254 | 255 |
255 // Functions outside the API scope. | 256 // Functions outside the API scope. |
256 | 257 |
257 template <> | 258 template <> |
258 void | 259 void |
259 BrowserContextKeyedAPIFactory<AudioModemAPI>::DeclareFactoryDependencies() { | 260 BrowserContextKeyedAPIFactory<AudioModemAPI>::DeclareFactoryDependencies() { |
260 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 261 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 ExtensionFunction::ResponseAction AudioModemStopReceiveFunction::Run() { | 340 ExtensionFunction::ResponseAction AudioModemStopReceiveFunction::Run() { |
340 scoped_ptr<StopReceive::Params> params(StopReceive::Params::Create(*args_)); | 341 scoped_ptr<StopReceive::Params> params(StopReceive::Params::Create(*args_)); |
341 EXTENSION_FUNCTION_VALIDATE(params.get()); | 342 EXTENSION_FUNCTION_VALIDATE(params.get()); |
342 | 343 |
343 Status status = AudioModemAPI::GetFactoryInstance()->Get(browser_context()) | 344 Status status = AudioModemAPI::GetFactoryInstance()->Get(browser_context()) |
344 ->StopReceive(extension_id(), AudioTypeForBand(params->band)); | 345 ->StopReceive(extension_id(), AudioTypeForBand(params->band)); |
345 return RespondNow(ArgumentList(StopReceive::Results::Create(status))); | 346 return RespondNow(ArgumentList(StopReceive::Results::Create(status))); |
346 } | 347 } |
347 | 348 |
348 } // namespace extensions | 349 } // namespace extensions |
OLD | NEW |