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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 GeolocationPosition* position = (*m_controllers.begin())->lastPosition(); | 55 GeolocationPosition* position = (*m_controllers.begin())->lastPosition(); |
56 if (!m_geolocationOverridden && position) | 56 if (!m_geolocationOverridden && position) |
57 m_platformGeolocationPosition = position; | 57 m_platformGeolocationPosition = position; |
58 | 58 |
59 m_geolocationOverridden = true; | 59 m_geolocationOverridden = true; |
60 if (latitude && longitude && accuracy) | 60 if (latitude && longitude && accuracy) |
61 m_geolocationPosition = GeolocationPosition::create(currentTime(), *lati
tude, *longitude, *accuracy); | 61 m_geolocationPosition = GeolocationPosition::create(currentTime(), *lati
tude, *longitude, *accuracy); |
62 else | 62 else |
63 m_geolocationPosition.clear(); | 63 m_geolocationPosition.clear(); |
64 | 64 |
65 for (WTF::HashSet<GeolocationController*>::iterator it = m_controllers.begin
(); it != m_controllers.end(); ++it) | 65 for (GeolocationControllers::iterator it = m_controllers.begin(); it != m_co
ntrollers.end(); ++it) |
66 (*it)->positionChanged(0); // Kick location update. | 66 (*it)->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 (GeolocationPosition* platformPosition = m_platformGeolocationPosition.ge
t()) { |
77 for (WTF::HashSet<GeolocationController*>::iterator it = m_controllers.b
egin(); it != m_controllers.end(); ++it) | 77 for (GeolocationControllers::iterator it = m_controllers.begin(); it !=
m_controllers.end(); ++it) |
78 (*it)->positionChanged(m_platformGeolocationPosition.get()); | 78 (*it)->positionChanged(platformPosition); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 GeolocationPosition* GeolocationInspectorAgent::overrideGeolocationPosition(Geol
ocationPosition* position) | 82 GeolocationPosition* GeolocationInspectorAgent::overrideGeolocationPosition(Geol
ocationPosition* position) |
83 { | 83 { |
84 if (m_geolocationOverridden) { | 84 if (m_geolocationOverridden) { |
85 if (position) | 85 if (position) |
86 m_platformGeolocationPosition = position; | 86 m_platformGeolocationPosition = position; |
87 return m_geolocationPosition.get(); | 87 return m_geolocationPosition.get(); |
88 } | 88 } |
89 return position; | 89 return position; |
90 } | 90 } |
91 | 91 |
92 void GeolocationInspectorAgent::AddController(GeolocationController* controller) | 92 void GeolocationInspectorAgent::AddController(GeolocationController* controller) |
93 { | 93 { |
94 m_controllers.add(controller); | 94 m_controllers.add(controller); |
95 } | 95 } |
96 | 96 |
97 void GeolocationInspectorAgent::RemoveController(GeolocationController* controll
er) | 97 void GeolocationInspectorAgent::RemoveController(GeolocationController* controll
er) |
98 { | 98 { |
99 m_controllers.remove(controller); | 99 m_controllers.remove(controller); |
100 } | 100 } |
101 | 101 |
102 } // namespace WebCore | 102 } // namespace WebCore |
OLD | NEW |