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

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

Issue 10316007: Make the Geoposition helper class public (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix forward-declaration of struct as class. Created 8 years, 7 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) 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/public/browser/geolocation.h" 5 #include "content/public/browser/geolocation.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/message_loop_proxy.h" 11 #include "base/message_loop_proxy.h"
12 #include "content/browser/geolocation/geolocation_provider.h" 12 #include "content/browser/geolocation/geolocation_provider.h"
13 #include "content/common/geoposition.h"
14 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/common/geoposition.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 namespace { 18 namespace {
19 19
20 void OverrideLocationForTestingOnIOThread( 20 void OverrideLocationForTestingOnIOThread(
21 double latitude, 21 const Geoposition& position,
22 double longitude,
23 double altitude,
24 const base::Closure& completion_callback, 22 const base::Closure& completion_callback,
25 scoped_refptr<base::MessageLoopProxy> callback_loop) { 23 scoped_refptr<base::MessageLoopProxy> callback_loop) {
26 Geoposition position;
27 position.latitude = latitude;
28 position.longitude = longitude;
29 position.altitude = altitude;
30 position.accuracy = 0;
31 position.timestamp = base::Time::Now();
32 GeolocationProvider::GetInstance()->OverrideLocationForTesting(position); 24 GeolocationProvider::GetInstance()->OverrideLocationForTesting(position);
33 callback_loop->PostTask(FROM_HERE, completion_callback); 25 callback_loop->PostTask(FROM_HERE, completion_callback);
34 } 26 }
35 27
36 } // namespace 28 } // namespace
37 29
38 void OverrideLocationForTesting( 30 void OverrideLocationForTesting(
39 double latitude, 31 const Geoposition& position,
40 double longitude,
41 double altitude,
42 const base::Closure& completion_callback) { 32 const base::Closure& completion_callback) {
43 base::Closure closure = base::Bind( 33 base::Closure closure = base::Bind(&OverrideLocationForTestingOnIOThread,
44 &OverrideLocationForTestingOnIOThread, 34 position,
45 latitude, longitude, altitude, completion_callback, 35 completion_callback,
46 base::MessageLoopProxy::current()); 36 base::MessageLoopProxy::current());
47 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 37 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
48 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, closure); 38 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, closure);
49 } else { 39 } else {
50 closure.Run(); 40 closure.Run();
51 } 41 }
52 } 42 }
53 43
54 } // namespace content 44 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/core_location_provider_mac.mm ('k') | content/browser/geolocation/geolocation_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698