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

Side by Side Diff: content/browser/geolocation/win7_location_provider_win.cc

Issue 10107017: Remove requesting_frame parameters from Geolocation stack (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comment addressed. Created 8 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
« no previous file with comments | « content/browser/geolocation/win7_location_provider_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/geolocation/win7_location_provider_win.h" 5 #include "content/browser/geolocation/win7_location_provider_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 void Win7LocationProvider::GetPosition(Geoposition* position) { 69 void Win7LocationProvider::GetPosition(Geoposition* position) {
70 DCHECK(position); 70 DCHECK(position);
71 *position = position_; 71 *position = position_;
72 } 72 }
73 73
74 void Win7LocationProvider::UpdatePosition() { 74 void Win7LocationProvider::UpdatePosition() {
75 ScheduleNextPoll(0); 75 ScheduleNextPoll(0);
76 } 76 }
77 77
78 void Win7LocationProvider::OnPermissionGranted(
79 const GURL& requesting_frame) {
80 }
81
82 void Win7LocationProvider::DoPollTask() { 78 void Win7LocationProvider::DoPollTask() {
83 Geoposition new_position; 79 Geoposition new_position;
84 api_->GetPosition(&new_position); 80 api_->GetPosition(&new_position);
85 const bool differ = PositionsDifferSiginificantly(position_, new_position); 81 const bool differ = PositionsDifferSiginificantly(position_, new_position);
86 ScheduleNextPoll(differ ? kPollPeriodMovingMillis : 82 ScheduleNextPoll(differ ? kPollPeriodMovingMillis :
87 kPollPeriodStationaryMillis); 83 kPollPeriodStationaryMillis);
88 if (differ || new_position.error_code != Geoposition::ERROR_CODE_NONE) { 84 if (differ || new_position.error_code != Geoposition::ERROR_CODE_NONE) {
89 // Update if the new location is interesting or we have an error to report 85 // Update if the new location is interesting or we have an error to report
90 position_ = new_position; 86 position_ = new_position;
91 UpdateListeners(); 87 UpdateListeners();
92 } 88 }
93 } 89 }
94 90
95 void Win7LocationProvider::ScheduleNextPoll(int interval) { 91 void Win7LocationProvider::ScheduleNextPoll(int interval) {
96 MessageLoop::current()->PostDelayedTask( 92 MessageLoop::current()->PostDelayedTask(
97 FROM_HERE, 93 FROM_HERE,
98 base::Bind(&Win7LocationProvider::DoPollTask, weak_factory_.GetWeakPtr()), 94 base::Bind(&Win7LocationProvider::DoPollTask, weak_factory_.GetWeakPtr()),
99 base::TimeDelta::FromMilliseconds(interval)); 95 base::TimeDelta::FromMilliseconds(interval));
100 } 96 }
101 97
102 LocationProviderBase* NewSystemLocationProvider() { 98 LocationProviderBase* NewSystemLocationProvider() {
103 Win7LocationApi* api = Win7LocationApi::Create(); 99 Win7LocationApi* api = Win7LocationApi::Create();
104 if (api == NULL) 100 if (api == NULL)
105 return NULL; // API not supported on this machine. 101 return NULL; // API not supported on this machine.
106 return new Win7LocationProvider(api); 102 return new Win7LocationProvider(api);
107 } 103 }
OLDNEW
« no previous file with comments | « content/browser/geolocation/win7_location_provider_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698