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

Side by Side Diff: Source/modules/geolocation/GeolocationController.cpp

Issue 307943002: Oilpan: Prepare moving InspectorController and InspectorAgents to oilpan. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
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
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 { 53 } else {
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 m_inspectorAgent->AddController(this); 57 m_inspectorAgent->addController(this);
58 58
59 if (!frame.isMainFrame()) { 59 if (!frame.isMainFrame()) {
60 // internals.setGeolocationClientMock is per page. 60 // internals.setGeolocationClientMock is per page.
61 GeolocationController* mainController = GeolocationController::from(fram e.page()->deprecatedLocalMainFrame()); 61 GeolocationController* mainController = GeolocationController::from(fram e.page()->deprecatedLocalMainFrame());
62 if (mainController->hasClientForTest()) 62 if (mainController->hasClientForTest())
63 setClientForTest(mainController->client()); 63 setClientForTest(mainController->client());
64 } 64 }
65 } 65 }
66 66
67 void GeolocationController::startUpdatingIfNeeded() 67 void GeolocationController::startUpdatingIfNeeded()
68 { 68 {
69 if (m_isClientUpdating) 69 if (m_isClientUpdating)
70 return; 70 return;
71 m_isClientUpdating = true; 71 m_isClientUpdating = true;
72 m_client->startUpdating(); 72 m_client->startUpdating();
73 } 73 }
74 74
75 void GeolocationController::stopUpdatingIfNeeded() 75 void GeolocationController::stopUpdatingIfNeeded()
76 { 76 {
77 if (!m_isClientUpdating) 77 if (!m_isClientUpdating)
78 return; 78 return;
79 m_isClientUpdating = false; 79 m_isClientUpdating = false;
80 m_client->stopUpdating(); 80 m_client->stopUpdating();
81 } 81 }
82 82
83 GeolocationController::~GeolocationController() 83 GeolocationController::~GeolocationController()
84 { 84 {
85 ASSERT(m_observers.isEmpty()); 85 ASSERT(m_observers.isEmpty());
86 if (page()) 86 if (page())
87 m_inspectorAgent->RemoveController(this); 87 m_inspectorAgent->removeController(this);
88 88
89 if (m_hasClientForTest) 89 if (m_hasClientForTest)
90 m_client->controllerForTestRemoved(this); 90 m_client->controllerForTestRemoved(this);
91 } 91 }
92 92
93 // FIXME: Oilpan: Once GeolocationClient is on-heap m_client should be a strong 93 // FIXME: Oilpan: Once GeolocationClient is on-heap m_client should be a strong
94 // pointer and |willBeDestroyed| can potentially be removed from Supplement. 94 // pointer and |willBeDestroyed| can potentially be removed from Supplement.
95 void GeolocationController::willBeDestroyed() 95 void GeolocationController::willBeDestroyed()
96 { 96 {
97 if (m_client) 97 if (m_client)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 visitor->trace(m_highAccuracyObservers); 219 visitor->trace(m_highAccuracyObservers);
220 WillBeHeapSupplement<LocalFrame>::trace(visitor); 220 WillBeHeapSupplement<LocalFrame>::trace(visitor);
221 } 221 }
222 222
223 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) 223 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client)
224 { 224 {
225 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su pplementName(), GeolocationController::create(frame, client)); 225 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su pplementName(), GeolocationController::create(frame, client));
226 } 226 }
227 227
228 } // namespace WebCore 228 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698