extension_id_(extension_id),
location_manager_(location_manager) {
// TODO(vadimt): use request_info.
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (time_between_updates_ms) {
update_policies_.push_back(
}
void LocationRequest::Initialize() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
callback_ = base::Bind(&LocationRequest::OnLocationUpdate,
base::Unretained(this));
}
void LocationRequest::GrantPermission() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
content::GeolocationProvider::GetInstance()->UserDidOptIntoLocationServices();
}
LocationRequest::~LocationRequest() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
content::GeolocationProvider::GetInstance()->RemoveLocationUpdateCallback(
callback_);
}
void LocationRequest::AddObserverOnIOThread() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
// TODO(vadimt): This can get a location cached by GeolocationProvider,
// contrary to the API definition which says that creating a location watch
}
void LocationRequest::OnLocationUpdate(const content::Geoposition& position) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (ShouldSendUpdate(position)) {
OnPositionReported(position);
BrowserThread::PostTask(
}
bool LocationRequest::ShouldSendUpdate(const content::Geoposition& position) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
for (UpdatePolicyVector::iterator it = update_policies_.begin();
it != update_policies_.end();
++it) {
}
void LocationRequest::OnPositionReported(const content::Geoposition& position) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
for (UpdatePolicyVector::iterator it = update_policies_.begin();
it != update_policies_.end();
++it) {
LocationManager::LocationManager(content::BrowserContext* context)
: profile_(Profile::FromBrowserContext(context)) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
content::Source<Profile>(profile_));
const std::string& request_name,
const double* distance_update_threshold_meters,
const double* time_between_updates_ms) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
// TODO(vadimt): Consider resuming requests after restarting the browser.
// Override any old request with the same name.
void LocationManager::RemoveLocationRequest(const std::string& extension_id,
const std::string& name) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
std::pair<LocationRequestMap::iterator, LocationRequestMap::iterator>
extension_range = location_requests_.equal_range(extension_id);
const std::string& extension_id,
const std::string& request_name,
const content::Geoposition& position) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
scoped_ptr<base::ListValue> args(new base::ListValue());
std::string event_name;
scoped_ptr<Event> event(new Event(event_name, args.Pass()));
- ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id, event.Pass());
+ EventRouter::Get(profile_)
+ ->DispatchEventToExtension(extension_id, event.Pass());
}
void LocationManager::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
switch (type) {
- case chrome::NOTIFICATION_EXTENSION_LOADED: {
+ case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
// Grants permission to use geolocation once an extension with "location"
// permission is loaded.
const Extension* extension =