OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 void GeolocationInspectorAgent::setGeolocationOverride(ErrorString* error, const
double* latitude, const double* longitude, const double* accuracy) | 54 void GeolocationInspectorAgent::setGeolocationOverride(ErrorString* error, const
double* latitude, const double* longitude, const double* accuracy) |
55 { | 55 { |
56 GeolocationPosition* position = m_controller->lastPosition(); | 56 GeolocationPosition* position = m_controller->lastPosition(); |
57 if (!m_geolocationOverridden && position) | 57 if (!m_geolocationOverridden && position) |
58 m_platformGeolocationPosition = position; | 58 m_platformGeolocationPosition = position; |
59 | 59 |
60 m_geolocationOverridden = true; | 60 m_geolocationOverridden = true; |
61 if (latitude && longitude && accuracy) | 61 if (latitude && longitude && accuracy) |
62 m_geolocationPosition = GeolocationPosition::create(currentTimeMS(), *la
titude, *longitude, *accuracy); | 62 m_geolocationPosition = GeolocationPosition::create(currentTime(), *lati
tude, *longitude, *accuracy); |
63 else | 63 else |
64 m_geolocationPosition.clear(); | 64 m_geolocationPosition.clear(); |
65 | 65 |
66 m_controller->positionChanged(0); // Kick location update. | 66 m_controller->positionChanged(0); // Kick location update. |
67 } | 67 } |
68 | 68 |
69 void GeolocationInspectorAgent::clearGeolocationOverride(ErrorString*) | 69 void GeolocationInspectorAgent::clearGeolocationOverride(ErrorString*) |
70 { | 70 { |
71 if (!m_geolocationOverridden) | 71 if (!m_geolocationOverridden) |
72 return; | 72 return; |
73 m_geolocationOverridden = false; | 73 m_geolocationOverridden = false; |
74 m_geolocationPosition.clear(); | 74 m_geolocationPosition.clear(); |
75 | 75 |
76 if (m_platformGeolocationPosition.get()) | 76 if (m_platformGeolocationPosition.get()) |
77 m_controller->positionChanged(m_platformGeolocationPosition.get()); | 77 m_controller->positionChanged(m_platformGeolocationPosition.get()); |
78 } | 78 } |
79 | 79 |
80 GeolocationPosition* GeolocationInspectorAgent::overrideGeolocationPosition(Geol
ocationPosition* position) | 80 GeolocationPosition* GeolocationInspectorAgent::overrideGeolocationPosition(Geol
ocationPosition* position) |
81 { | 81 { |
82 if (m_geolocationOverridden) { | 82 if (m_geolocationOverridden) { |
83 if (position) | 83 if (position) |
84 m_platformGeolocationPosition = position; | 84 m_platformGeolocationPosition = position; |
85 return m_geolocationPosition.get(); | 85 return m_geolocationPosition.get(); |
86 } | 86 } |
87 return position; | 87 return position; |
88 } | 88 } |
89 | 89 |
90 } // namespace WebCore | 90 } // namespace WebCore |
OLD | NEW |