OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 29 matching lines...) Expand all Loading... |
40 : PageLifecycleObserver(frame.page()) | 40 : PageLifecycleObserver(frame.page()) |
41 , m_client(client) | 41 , m_client(client) |
42 , m_hasClientForTest(false) | 42 , m_hasClientForTest(false) |
43 , m_isClientUpdating(false) | 43 , m_isClientUpdating(false) |
44 , m_inspectorAgent() | 44 , m_inspectorAgent() |
45 { | 45 { |
46 // FIXME: Once GeolocationInspectorAgent is per frame, there will be a 1:1 r
elationship between | 46 // FIXME: Once GeolocationInspectorAgent is per frame, there will be a 1:1 r
elationship between |
47 // it and this class. Until then, there's one GeolocationInspectorAgent per
page that the main | 47 // it and this class. Until then, there's one GeolocationInspectorAgent per
page that the main |
48 // frame is responsible for creating. | 48 // frame is responsible for creating. |
49 if (frame.isMainFrame()) { | 49 if (frame.isMainFrame()) { |
50 OwnPtr<GeolocationInspectorAgent> geolocationAgent(GeolocationInspectorA
gent::create()); | 50 OwnPtrWillBeRawPtr<GeolocationInspectorAgent> geolocationAgent(Geolocati
onInspectorAgent::create()); |
51 m_inspectorAgent = geolocationAgent.get(); | 51 m_inspectorAgent = geolocationAgent.get(); |
52 frame.page()->inspectorController().registerModuleAgent(geolocationAgent
.release()); | 52 frame.page()->inspectorController().registerModuleAgent(geolocationAgent
.release()); |
53 } else if (frame.page()->mainFrame()->isLocalFrame()) { | 53 } else if (frame.page()->mainFrame()->isLocalFrame()) { |
54 m_inspectorAgent = GeolocationController::from(frame.page()->deprecatedL
ocalMainFrame())->m_inspectorAgent; | 54 m_inspectorAgent = GeolocationController::from(frame.page()->deprecatedL
ocalMainFrame())->m_inspectorAgent; |
55 } | 55 } |
56 | 56 |
57 if (m_inspectorAgent) | 57 m_inspectorAgent->addController(this); |
58 m_inspectorAgent->AddController(this); | |
59 | 58 |
60 if (!frame.isMainFrame() && frame.page()->mainFrame()->isLocalFrame()) { | 59 if (!frame.isMainFrame() && frame.page()->mainFrame()->isLocalFrame()) { |
61 // internals.setGeolocationClientMock is per page. | 60 // internals.setGeolocationClientMock is per page. |
62 GeolocationController* mainController = GeolocationController::from(fram
e.page()->deprecatedLocalMainFrame()); | 61 GeolocationController* mainController = GeolocationController::from(fram
e.page()->deprecatedLocalMainFrame()); |
63 if (mainController->hasClientForTest()) | 62 if (mainController->hasClientForTest()) |
64 setClientForTest(mainController->client()); | 63 setClientForTest(mainController->client()); |
65 } | 64 } |
66 } | 65 } |
67 | 66 |
68 void GeolocationController::startUpdatingIfNeeded() | 67 void GeolocationController::startUpdatingIfNeeded() |
(...skipping 13 matching lines...) Expand all Loading... |
82 } | 81 } |
83 | 82 |
84 GeolocationController::~GeolocationController() | 83 GeolocationController::~GeolocationController() |
85 { | 84 { |
86 ASSERT(m_observers.isEmpty()); | 85 ASSERT(m_observers.isEmpty()); |
87 detach(); | 86 detach(); |
88 } | 87 } |
89 | 88 |
90 void GeolocationController::detach() | 89 void GeolocationController::detach() |
91 { | 90 { |
| 91 #if !ENABLE(OILPAN) |
92 if (page() && m_inspectorAgent) { | 92 if (page() && m_inspectorAgent) { |
93 m_inspectorAgent->RemoveController(this); | 93 m_inspectorAgent->removeController(this); |
94 m_inspectorAgent = 0; | 94 m_inspectorAgent = nullptr; |
95 } | 95 } |
| 96 #endif |
96 | 97 |
97 if (m_hasClientForTest) { | 98 if (m_hasClientForTest) { |
98 m_client->controllerForTestRemoved(this); | 99 m_client->controllerForTestRemoved(this); |
99 m_hasClientForTest = false; | 100 m_hasClientForTest = false; |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 // FIXME: Oilpan: Once GeolocationClient is on-heap m_client should be a strong | 104 // FIXME: Oilpan: Once GeolocationClient is on-heap m_client should be a strong |
104 // pointer and |willBeDestroyed| can potentially be removed from Supplement. | 105 // pointer and |willBeDestroyed| can potentially be removed from Supplement. |
105 void GeolocationController::willBeDestroyed() | 106 void GeolocationController::willBeDestroyed() |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 const char* GeolocationController::supplementName() | 224 const char* GeolocationController::supplementName() |
224 { | 225 { |
225 return "GeolocationController"; | 226 return "GeolocationController"; |
226 } | 227 } |
227 | 228 |
228 void GeolocationController::trace(Visitor* visitor) | 229 void GeolocationController::trace(Visitor* visitor) |
229 { | 230 { |
230 visitor->trace(m_lastPosition); | 231 visitor->trace(m_lastPosition); |
231 visitor->trace(m_observers); | 232 visitor->trace(m_observers); |
232 visitor->trace(m_highAccuracyObservers); | 233 visitor->trace(m_highAccuracyObservers); |
| 234 visitor->trace(m_inspectorAgent); |
233 WillBeHeapSupplement<LocalFrame>::trace(visitor); | 235 WillBeHeapSupplement<LocalFrame>::trace(visitor); |
234 } | 236 } |
235 | 237 |
236 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) | 238 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) |
237 { | 239 { |
238 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su
pplementName(), GeolocationController::create(frame, client)); | 240 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su
pplementName(), GeolocationController::create(frame, client)); |
239 } | 241 } |
240 | 242 |
241 } // namespace blink | 243 } // namespace blink |
OLD | NEW |