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

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

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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) 2000 Harri Porten (porten@kde.org) 2 * Copyright (C) 2000 Harri Porten (porten@kde.org)
3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) 3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org) 4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 26 matching lines...) Expand all
37 37
38 NavigatorGeolocation::~NavigatorGeolocation() 38 NavigatorGeolocation::~NavigatorGeolocation()
39 { 39 {
40 } 40 }
41 41
42 const char* NavigatorGeolocation::supplementName() 42 const char* NavigatorGeolocation::supplementName()
43 { 43 {
44 return "NavigatorGeolocation"; 44 return "NavigatorGeolocation";
45 } 45 }
46 46
47 NavigatorGeolocation* NavigatorGeolocation::from(Navigator* navigator) 47 NavigatorGeolocation& NavigatorGeolocation::from(Navigator& navigator)
48 { 48 {
49 NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>(Supple ment<Navigator>::from(navigator, supplementName())); 49 NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>(Supple ment<Navigator>::from(navigator, supplementName()));
50 if (!supplement) { 50 if (!supplement) {
51 supplement = new NavigatorGeolocation(navigator->frame()); 51 supplement = new NavigatorGeolocation(navigator.frame());
52 provideTo(navigator, supplementName(), adoptPtr(supplement)); 52 provideTo(navigator, supplementName(), adoptPtr(supplement));
53 } 53 }
54 return supplement; 54 return *supplement;
55 } 55 }
56 56
57 Geolocation* NavigatorGeolocation::geolocation(Navigator* navigator) 57 Geolocation* NavigatorGeolocation::geolocation(Navigator& navigator)
58 { 58 {
59 return NavigatorGeolocation::from(navigator)->geolocation(); 59 return NavigatorGeolocation::from(navigator).geolocation();
60 } 60 }
61 61
62 Geolocation* NavigatorGeolocation::geolocation() const 62 Geolocation* NavigatorGeolocation::geolocation() const
63 { 63 {
64 if (!m_geolocation && frame()) 64 if (!m_geolocation && frame())
65 m_geolocation = Geolocation::create(frame()->document()); 65 m_geolocation = Geolocation::create(frame()->document());
66 return m_geolocation.get(); 66 return m_geolocation.get();
67 } 67 }
68 68
69 } // namespace WebCore 69 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698