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

Side by Side Diff: chrome/browser/extensions/api/audio_modem/audio_modem_api.cc

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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 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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698