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

Side by Side Diff: chrome/browser/extensions/api/location/location_manager.cc

Issue 238633009: cleanup: Use EventRouter instead of ExtensionSystem::Get->event_router() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile error for chromeos build. Created 6 years, 8 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/location/location_manager.h" 5 #include "chrome/browser/extensions/api/location/location_manager.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 event_name = location::OnLocationUpdate::kEventName; 386 event_name = location::OnLocationUpdate::kEventName;
387 } else { 387 } else {
388 // Set data for onLocationError event. 388 // Set data for onLocationError event.
389 // TODO(vadimt): Set name. 389 // TODO(vadimt): Set name.
390 args->AppendString(position.error_message); 390 args->AppendString(position.error_message);
391 event_name = location::OnLocationError::kEventName; 391 event_name = location::OnLocationError::kEventName;
392 } 392 }
393 393
394 scoped_ptr<Event> event(new Event(event_name, args.Pass())); 394 scoped_ptr<Event> event(new Event(event_name, args.Pass()));
395 395
396 ExtensionSystem::Get(profile_)->event_router()-> 396 EventRouter::Get(profile_)
397 DispatchEventToExtension(extension_id, event.Pass()); 397 ->DispatchEventToExtension(extension_id, event.Pass());
398 } 398 }
399 399
400 void LocationManager::Observe(int type, 400 void LocationManager::Observe(int type,
401 const content::NotificationSource& source, 401 const content::NotificationSource& source,
402 const content::NotificationDetails& details) { 402 const content::NotificationDetails& details) {
403 DCHECK_CURRENTLY_ON(BrowserThread::UI); 403 DCHECK_CURRENTLY_ON(BrowserThread::UI);
404 404
405 switch (type) { 405 switch (type) {
406 case chrome::NOTIFICATION_EXTENSION_LOADED: { 406 case chrome::NOTIFICATION_EXTENSION_LOADED: {
407 // Grants permission to use geolocation once an extension with "location" 407 // Grants permission to use geolocation once an extension with "location"
(...skipping 30 matching lines...) Expand all
438 LocationManager::GetFactoryInstance() { 438 LocationManager::GetFactoryInstance() {
439 return g_factory.Pointer(); 439 return g_factory.Pointer();
440 } 440 }
441 441
442 // static 442 // static
443 LocationManager* LocationManager::Get(content::BrowserContext* context) { 443 LocationManager* LocationManager::Get(content::BrowserContext* context) {
444 return BrowserContextKeyedAPIFactory<LocationManager>::Get(context); 444 return BrowserContextKeyedAPIFactory<LocationManager>::Get(context);
445 } 445 }
446 446
447 } // namespace extensions 447 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698