Changeset 108958 in webkit


Ignore:
Timestamp:
Feb 26, 2012 10:33:45 PM (12 years ago)
Author:
abarth@webkit.org
Message:

Extract Supplementable base class from Page and Navigator
https://bugs.webkit.org/show_bug.cgi?id=79624

Reviewed by Hajime Morita.

We'll use this pattern again soon for ScriptExecutionContext.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Modules/gamepad/NavigatorGamepad.cpp:

(WebCore::NavigatorGamepad::from):

  • Modules/gamepad/NavigatorGamepad.h:
  • Modules/geolocation/NavigatorGeolocation.cpp:

(WebCore::NavigatorGeolocation::from):

  • Modules/geolocation/NavigatorGeolocation.h:
  • Modules/mediastream/NavigatorMediaStream.cpp:

(WebCore::NavigatorMediaStream::webkitGetUserMedia):

  • Modules/mediastream/UserMediaController.cpp:

(WebCore::provideUserMediaTo):

  • Modules/mediastream/UserMediaController.h:

(WebCore::UserMediaController::from):

  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/DeviceMotionController.cpp:

(WebCore::provideDeviceMotionTo):

  • dom/DeviceMotionController.h:

(WebCore::DeviceMotionController::from):

  • dom/DeviceOrientationController.cpp:

(WebCore::provideDeviceOrientationTo):

  • dom/DeviceOrientationController.h:

(WebCore):
(WebCore::DeviceOrientationController::from):

  • notifications/NotificationController.cpp:

(WebCore::provideNotification):

  • notifications/NotificationController.h:

(WebCore):
(WebCore::NotificationController::from):

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::page):
(WebCore):
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::removeEventListener):
(WebCore::DOMWindow::removeAllEventListeners):

  • page/DOMWindow.h:

(WebCore):
(DOMWindow):

  • page/Navigator.cpp:

(WebCore):

  • page/Navigator.h:

(Navigator):

  • page/NavigatorSupplement.cpp: Removed.
  • page/NavigatorSupplement.h: Removed.
  • page/Page.cpp:

(WebCore):

  • page/Page.h:

(Page):

  • page/PageSupplement.cpp: Removed.
  • page/PageSupplement.h: Removed.
  • page/SpeechInput.cpp:

(WebCore::provideSpeechInputTo):

  • page/SpeechInput.h:

(WebCore::SpeechInput::from):

  • platform/Supplementable.h: Added.

(WebCore):
(Supplement):
(WebCore::Supplement::~Supplement):
(WebCore::Supplement::provideTo):
(WebCore::Supplement::from):
(Supplementable):
(WebCore::Supplementable::provideSupplement):
(WebCore::Supplementable::requireSupplement):

Location:
trunk/Source/WebCore
Files:
1 added
4 deleted
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r108954 r108958  
    10381038    page/NavigatorBase.cpp
    10391039    page/NavigatorRegisterProtocolHandler.cpp
    1040     page/NavigatorSupplement.cpp
    10411040    page/OriginAccessEntry.cpp
    10421041    page/Page.cpp
     
    10441043    page/PageGroupLoadDeferrer.cpp
    10451044    page/PageSerializer.cpp
    1046     page/PageSupplement.cpp
    10471045    page/PageVisibilityState.cpp
    10481046    page/Performance.cpp
  • trunk/Source/WebCore/ChangeLog

    r108957 r108958  
     12012-02-26  Adam Barth  <abarth@webkit.org>
     2
     3        Extract Supplementable base class from Page and Navigator
     4        https://bugs.webkit.org/show_bug.cgi?id=79624
     5
     6        Reviewed by Hajime Morita.
     7
     8        We'll use this pattern again soon for ScriptExecutionContext.
     9
     10        * CMakeLists.txt:
     11        * GNUmakefile.list.am:
     12        * Modules/gamepad/NavigatorGamepad.cpp:
     13        (WebCore::NavigatorGamepad::from):
     14        * Modules/gamepad/NavigatorGamepad.h:
     15        * Modules/geolocation/NavigatorGeolocation.cpp:
     16        (WebCore::NavigatorGeolocation::from):
     17        * Modules/geolocation/NavigatorGeolocation.h:
     18        * Modules/mediastream/NavigatorMediaStream.cpp:
     19        (WebCore::NavigatorMediaStream::webkitGetUserMedia):
     20        * Modules/mediastream/UserMediaController.cpp:
     21        (WebCore::provideUserMediaTo):
     22        * Modules/mediastream/UserMediaController.h:
     23        (WebCore::UserMediaController::from):
     24        * Target.pri:
     25        * WebCore.gypi:
     26        * WebCore.vcproj/WebCore.vcproj:
     27        * WebCore.xcodeproj/project.pbxproj:
     28        * dom/DeviceMotionController.cpp:
     29        (WebCore::provideDeviceMotionTo):
     30        * dom/DeviceMotionController.h:
     31        (WebCore::DeviceMotionController::from):
     32        * dom/DeviceOrientationController.cpp:
     33        (WebCore::provideDeviceOrientationTo):
     34        * dom/DeviceOrientationController.h:
     35        (WebCore):
     36        (WebCore::DeviceOrientationController::from):
     37        * notifications/NotificationController.cpp:
     38        (WebCore::provideNotification):
     39        * notifications/NotificationController.h:
     40        (WebCore):
     41        (WebCore::NotificationController::from):
     42        * page/DOMWindow.cpp:
     43        (WebCore::DOMWindow::page):
     44        (WebCore):
     45        (WebCore::DOMWindow::addEventListener):
     46        (WebCore::DOMWindow::removeEventListener):
     47        (WebCore::DOMWindow::removeAllEventListeners):
     48        * page/DOMWindow.h:
     49        (WebCore):
     50        (DOMWindow):
     51        * page/Navigator.cpp:
     52        (WebCore):
     53        * page/Navigator.h:
     54        (Navigator):
     55        * page/NavigatorSupplement.cpp: Removed.
     56        * page/NavigatorSupplement.h: Removed.
     57        * page/Page.cpp:
     58        (WebCore):
     59        * page/Page.h:
     60        (Page):
     61        * page/PageSupplement.cpp: Removed.
     62        * page/PageSupplement.h: Removed.
     63        * page/SpeechInput.cpp:
     64        (WebCore::provideSpeechInputTo):
     65        * page/SpeechInput.h:
     66        (WebCore::SpeechInput::from):
     67        * platform/Supplementable.h: Added.
     68        (WebCore):
     69        (Supplement):
     70        (WebCore::Supplement::~Supplement):
     71        (WebCore::Supplement::provideTo):
     72        (WebCore::Supplement::from):
     73        (Supplementable):
     74        (WebCore::Supplementable::provideSupplement):
     75        (WebCore::Supplementable::requireSupplement):
     76
    1772012-02-26  Hajime Morrita  <morrita@chromium.org>
    278
  • trunk/Source/WebCore/GNUmakefile.list.am

    r108954 r108958  
    27832783        Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp \
    27842784        Source/WebCore/page/NavigatorRegisterProtocolHandler.h \
    2785         Source/WebCore/page/NavigatorSupplement.cpp \
    2786         Source/WebCore/page/NavigatorSupplement.h \
    27872785        Source/WebCore/page/OriginAccessEntry.cpp \
    27882786        Source/WebCore/page/OriginAccessEntry.h \
     
    27952793        Source/WebCore/page/PageSerializer.cpp \
    27962794        Source/WebCore/page/PageSerializer.h \
    2797         Source/WebCore/page/PageSupplement.cpp \
    2798         Source/WebCore/page/PageSupplement.h \
    27992795        Source/WebCore/page/PageVisibilityState.cpp \
    28002796        Source/WebCore/page/PageVisibilityState.h \
     
    33513347        Source/WebCore/platform/SSLKeyGenerator.h \
    33523348        Source/WebCore/platform/SuddenTermination.h \
     3349        Source/WebCore/platform/Supplementable.h \
    33533350        Source/WebCore/platform/SystemTime.h \
    33543351        Source/WebCore/platform/text/Base64.cpp \
  • trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp

    r107536 r108958  
    4747{
    4848    DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorGamepad"));
    49     NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(NavigatorSupplement::from(navigator, name));
     49    NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(Supplement<Navigator>::from(navigator, name));
    5050    if (!supplement) {
    5151        supplement = new NavigatorGamepad();
  • trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.h

    r107536 r108958  
    2929#if ENABLE(GAMEPAD)
    3030
    31 #include "NavigatorSupplement.h"
     31#include "Supplementable.h"
    3232
    3333namespace WebCore {
     
    3636class Navigator;
    3737
    38 class NavigatorGamepad : public NavigatorSupplement {
     38class NavigatorGamepad : public Supplement<Navigator> {
    3939public:
    4040    virtual ~NavigatorGamepad();
  • trunk/Source/WebCore/Modules/geolocation/NavigatorGeolocation.cpp

    r108428 r108958  
    5555{
    5656    DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorGeolocation"));
    57     NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>(NavigatorSupplement::from(navigator, name));
     57    NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>(Supplement<Navigator>::from(navigator, name));
    5858    if (!supplement) {
    5959        supplement = new NavigatorGeolocation(navigator->frame());
  • trunk/Source/WebCore/Modules/geolocation/NavigatorGeolocation.h

    r108428 r108958  
    2828
    2929#include "DOMWindowProperty.h"
    30 #include "NavigatorSupplement.h"
     30#include "Supplementable.h"
    3131
    3232namespace WebCore {
     
    3636class Navigator;
    3737
    38 class NavigatorGeolocation : public NavigatorSupplement, public DOMWindowProperty {
     38class NavigatorGeolocation : public Supplement<Navigator>, public DOMWindowProperty {
    3939public:
    4040    virtual ~NavigatorGeolocation();
  • trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.cpp

    r108437 r108958  
    5454        return;
    5555
    56     UserMediaController* userMedia = UserMediaController::from(navigator->frame());
     56    UserMediaController* userMedia = UserMediaController::from(navigator->frame() ? navigator->frame()->page() : 0);
    5757    if (!userMedia) {
    5858        ec = NOT_SUPPORTED_ERR;
  • trunk/Source/WebCore/Modules/mediastream/UserMediaController.cpp

    r108608 r108958  
    5353void provideUserMediaTo(Page* page, UserMediaClient* client)
    5454{
    55     PageSupplement::provideTo(page, UserMediaController::supplementName(), UserMediaController::create(client));
     55    UserMediaController::provideTo(page, UserMediaController::supplementName(), UserMediaController::create(client));
    5656}
    5757
  • trunk/Source/WebCore/Modules/mediastream/UserMediaController.h

    r108437 r108958  
    2828#if ENABLE(MEDIA_STREAM)
    2929
    30 #include "PageSupplement.h"
     30#include "Page.h"
    3131#include "UserMediaClient.h"
    3232#include <wtf/PassOwnPtr.h>
     
    3434namespace WebCore {
    3535
    36 class Frame;
    37 class Page;
    38 
    39 class UserMediaController : public PageSupplement {
     36class UserMediaController : public Supplement<Page> {
    4037public:
    4138    ~UserMediaController();
     
    4744    static PassOwnPtr<UserMediaController> create(UserMediaClient*);
    4845    static const AtomicString& supplementName();
    49     static UserMediaController* from(Frame* frame) { return static_cast<UserMediaController*>(PageSupplement::from(frame, supplementName())); }
    50     static UserMediaController* from(Page* page) { return static_cast<UserMediaController*>(PageSupplement::from(page, supplementName())); }
     46    static UserMediaController* from(Page* page) { return static_cast<UserMediaController*>(Supplement<Page>::from(page, supplementName())); }
    5147
    5248protected:
  • trunk/Source/WebCore/Modules/vibration/Vibration.cpp

    r108272 r108958  
    125125const AtomicString& Vibration::supplementName()
    126126{
    127     DEFINE_STATIC_LOCAL(AtomicString, name, ("vibration"));
     127    DEFINE_STATIC_LOCAL(AtomicString, name, ("Vibration"));
    128128    return name;
    129129}
     
    136136void provideVibrationTo(Page* page, VibrationClient* client)
    137137{
    138     PageSupplement::provideTo(page, Vibration::supplementName(), Vibration::create(client));
     138    Vibration::provideTo(page, Vibration::supplementName(), Vibration::create(client));
    139139}
    140140
  • trunk/Source/WebCore/Modules/vibration/Vibration.h

    r108272 r108958  
    2323#if ENABLE(VIBRATION)
    2424
    25 #include "PageSupplement.h"
     25#include "Page.h"
    2626#include "Timer.h"
    2727#include <wtf/PassOwnPtr.h>
     
    3333class VibrationClient;
    3434
    35 class Vibration : public PageSupplement {
     35class Vibration : public Supplement<Page> {
    3636public:
    3737    typedef Vector<unsigned long> VibrationPattern;
     
    5353
    5454    static const AtomicString& supplementName();
    55     static Vibration* from(Page* page) { return static_cast<Vibration*>(PageSupplement::from(page, supplementName())); }
     55    static Vibration* from(Page* page) { return static_cast<Vibration*>(Supplement<Page>::from(page, supplementName())); }
    5656    static bool isActive(Page*);
    5757
  • trunk/Source/WebCore/Target.pri

    r108954 r108958  
    10071007    page/NavigatorBase.cpp \
    10081008    page/NavigatorRegisterProtocolHandler.cpp \
    1009     page/NavigatorSupplement.cpp \
    10101009    page/OriginAccessEntry.cpp \
    10111010    page/Page.cpp \
    10121011    page/PageGroup.cpp \
    10131012    page/PageGroupLoadDeferrer.cpp \
    1014     page/PageSupplement.cpp \
    10151013    page/PageVisibilityState.cpp \
    10161014    page/Performance.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r108954 r108958  
    224224            'page/PageGroup.h',
    225225            'page/PageSerializer.h',
    226             'page/PageSupplement.h',
    227226            'page/PageVisibilityState.h',
    228227            'page/PrintContext.h',
     
    296295            'platform/SharedBuffer.h',
    297296            'platform/SharedBufferChunkReader.h',
     297            'platform/Supplementable.h',
    298298            'platform/SystemTime.h',
    299299            'platform/Theme.h',
     
    26832683            'page/NavigatorRegisterProtocolHandler.cpp',
    26842684            'page/NavigatorRegisterProtocolHandler.h',
    2685             'page/NavigatorSupplement.cpp',
    2686             'page/NavigatorSupplement.h',
    26872685            'page/OriginAccessEntry.cpp',
    26882686            'page/OriginAccessEntry.h',
     
    26922690            'page/PageGroupLoadDeferrer.h',
    26932691            'page/PageSerializer.cpp',
    2694             'page/PageSupplement.cpp',
    26952692            'page/PageVisibilityState.cpp',
    26962693            'page/Performance.cpp',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r108954 r108958  
    2571125711                        </File>
    2571225712                        <File
    25713                                 RelativePath="..\page\NavigatorSupplement.cpp"
    25714                                 >
    25715                         </File>
    25716                         <File
    25717                                 RelativePath="..\page\NavigatorSupplement.h"
    25718                                 >
    25719                         </File>
    25720                         <File
    2572125713                                RelativePath="..\page\OriginAccessEntry.cpp"
    2572225714                                >
     
    2575225744                        <File
    2575325745                                RelativePath="..\page\PageSerializer.h"
    25754                                 >
    25755                         </File>
    25756                         <File
    25757                                 RelativePath="..\page\PageSupplement.cpp"
    25758                                 >
    25759                         </File>
    25760                         <File
    25761                                 RelativePath="..\page\PageSupplement.h"
    2576225746                                >
    2576325747                        </File>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r108956 r108958  
    33533353                97627B8D14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */; };
    33543354                97627B8E14FB3CEE002CDCA1 /* ContextDestructionObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3355                97627B9814FB5424002CDCA1 /* Supplementable.h in Headers */ = {isa = PBXBuildFile; fileRef = 97627B9714FB5424002CDCA1 /* Supplementable.h */; settings = {ATTRIBUTES = (Private, ); }; };
    33553356                97665013144FAA4200F6BB51 /* EventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 97665011144FAA4200F6BB51 /* EventFactory.h */; };
    33563357                9766504F144FBFFE00F6BB51 /* EventFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */; };
     
    34673468                97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */; };
    34683469                97C471DC12F925BD0086354B /* ContentSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
    3469                 97CC3AE214E8E4A200894988 /* NavigatorSupplement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97CC3AE014E8E4A200894988 /* NavigatorSupplement.cpp */; };
    3470                 97CC3AE314E8E4A200894988 /* NavigatorSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = 97CC3AE114E8E4A200894988 /* NavigatorSupplement.h */; settings = {ATTRIBUTES = (Private, ); }; };
    34713470                97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */; };
    34723471                97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    35923591                A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
    35933592                A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; };
    3594                 A71E083714E3CEAF006A4619 /* PageSupplement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A71E083514E3CEAF006A4619 /* PageSupplement.cpp */; };
    3595                 A71E083814E3CEAF006A4619 /* PageSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = A71E083614E3CEAF006A4619 /* PageSupplement.h */; settings = {ATTRIBUTES = (Private, ); }; };
    35963593                A723F77B1484CA4C008C6DBE /* PlatformExportMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };
    35973594                A73F95FE12C97BFE0031AAF9 /* RoundedRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */; };
     
    1023810235                97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContextDestructionObserver.cpp; sourceTree = "<group>"; };
    1023910236                97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextDestructionObserver.h; sourceTree = "<group>"; };
     10237                97627B9714FB5424002CDCA1 /* Supplementable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Supplementable.h; sourceTree = "<group>"; };
    1024010238                97665011144FAA4200F6BB51 /* EventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventFactory.h; sourceTree = "<group>"; };
    1024110239                9766504E144FBFFE00F6BB51 /* EventFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventFactory.cpp; sourceTree = "<group>"; };
     
    1035610354                97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentSecurityPolicy.cpp; sourceTree = "<group>"; };
    1035710355                97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentSecurityPolicy.h; sourceTree = "<group>"; };
    10358                 97CC3AE014E8E4A200894988 /* NavigatorSupplement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorSupplement.cpp; sourceTree = "<group>"; };
    10359                 97CC3AE114E8E4A200894988 /* NavigatorSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorSupplement.h; sourceTree = "<group>"; };
    1036010356                97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowProperty.cpp; sourceTree = "<group>"; };
    1036110357                97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowProperty.h; sourceTree = "<group>"; };
     
    1049110487                A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; };
    1049210488                A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = "<group>"; };
    10493                 A71E083514E3CEAF006A4619 /* PageSupplement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageSupplement.cpp; sourceTree = "<group>"; };
    10494                 A71E083614E3CEAF006A4619 /* PageSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageSupplement.h; sourceTree = "<group>"; };
    1049510489                A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformExportMacros.h; sourceTree = "<group>"; };
    1049610490                A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RoundedRect.cpp; sourceTree = "<group>"; };
     
    1527415268                                9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */,
    1527515269                                9730BE1614EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.idl */,
    15276                                 97CC3AE014E8E4A200894988 /* NavigatorSupplement.cpp */,
    15277                                 97CC3AE114E8E4A200894988 /* NavigatorSupplement.h */,
    1527815270                                00146288103CD1DE000B20DB /* OriginAccessEntry.cpp */,
    1527915271                                00146289103CD1DE000B20DB /* OriginAccessEntry.h */,
     
    1528615278                                371E65CD13661EED00BEEDB0 /* PageSerializer.cpp */,
    1528715279                                371E65CB13661EDC00BEEDB0 /* PageSerializer.h */,
    15288                                 A71E083514E3CEAF006A4619 /* PageSupplement.cpp */,
    15289                                 A71E083614E3CEAF006A4619 /* PageSupplement.h */,
    1529015280                                FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */,
    1529115281                                FFD5B978135CC97800D5E92A /* PageVisibilityState.h */,
     
    1997019960                                F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */,
    1997119961                                93B2D8150F9920D2006AE6B2 /* SuddenTermination.h */,
     19962                                97627B9714FB5424002CDCA1 /* Supplementable.h */,
    1997219963                                93E62D990985F41600E1B5E3 /* SystemTime.h */,
    1997319964                                BCE65D310EAD1211007E4533 /* Theme.cpp */,
     
    2336523356                                9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */,
    2336623357                                97E4A12614F4C5D400870E43 /* NavigatorRegisterProtocolHandler.h in Headers */,
    23367                                 97CC3AE314E8E4A200894988 /* NavigatorSupplement.h in Headers */,
    2336823358                                8A309C9F123950BE00CB9204 /* NestingLevelIncrementer.h in Headers */,
    2336923359                                656D37430ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h in Headers */,
     
    2342923419                                F34742E51343633C00531BC2 /* PageScriptDebugServer.h in Headers */,
    2343023420                                371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */,
    23431                                 A71E083814E3CEAF006A4619 /* PageSupplement.h in Headers */,
    2343223421                                E1284AE110447D4500EAEB52 /* PageTransitionEvent.h in Headers */,
    2343323422                                51E1ECC30C91C90400DC255B /* PageURLRecord.h in Headers */,
     
    2388623875                                93B2D8160F9920D2006AE6B2 /* SuddenTermination.h in Headers */,
    2388723876                                97C078501165D5BE003A32EF /* SuffixTree.h in Headers */,
     23877                                97627B9814FB5424002CDCA1 /* Supplementable.h in Headers */,
    2388823878                                087558C613B4A57D00F49307 /* SurrogatePairAwareTextIterator.h in Headers */,
    2388923879                                62C1217D11AB9E77003C462C /* SuspendableTimer.h in Headers */,
     
    2652626516                                9711460314EF009A00674FD9 /* NavigatorGeolocation.cpp in Sources */,
    2652726517                                97E4A12714F4C5D700870E43 /* NavigatorRegisterProtocolHandler.cpp in Sources */,
    26528                                 97CC3AE214E8E4A200894988 /* NavigatorSupplement.cpp in Sources */,
    2652926518                                5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */,
    2653026519                                59C27F05138D28C10079B7E2 /* NetworkResourcesData.cpp in Sources */,
     
    2657426563                                F34742E41343633C00531BC2 /* PageScriptDebugServer.cpp in Sources */,
    2657526564                                371E65CE13661EED00BEEDB0 /* PageSerializer.cpp in Sources */,
    26576                                 A71E083714E3CEAF006A4619 /* PageSupplement.cpp in Sources */,
    2657726565                                E1284AEA10447DEE00EAEB52 /* PageTransitionEvent.cpp in Sources */,
    2657826566                                51E1ECC20C91C90400DC255B /* PageURLRecord.cpp in Sources */,
  • trunk/Source/WebCore/dom/DeviceMotionController.cpp

    r107536 r108958  
    151151void provideDeviceMotionTo(Page* page, DeviceMotionClient* client)
    152152{
    153     PageSupplement::provideTo(page, DeviceMotionController::supplementName(), DeviceMotionController::create(client));
     153    DeviceMotionController::provideTo(page, DeviceMotionController::supplementName(), DeviceMotionController::create(client));
    154154}
    155155
  • trunk/Source/WebCore/dom/DeviceMotionController.h

    r107518 r108958  
    2828
    2929#include "DOMWindow.h"
    30 #include "PageSupplement.h"
     30#include "Page.h"
    3131#include "Timer.h"
    3232#include <wtf/HashCountedSet.h>
     
    3737class DeviceMotionClient;
    3838
    39 class DeviceMotionController : public PageSupplement {
     39class DeviceMotionController : public Supplement<Page> {
    4040public:
    4141    ~DeviceMotionController();
     
    5555
    5656    static const AtomicString& supplementName();
    57     static DeviceMotionController* from(Frame* frame) { return static_cast<DeviceMotionController*>(PageSupplement::from(frame, supplementName())); }
    58     static DeviceMotionController* from(Page* page) { return static_cast<DeviceMotionController*>(PageSupplement::from(page, supplementName())); }
     57    static DeviceMotionController* from(Page* page) { return static_cast<DeviceMotionController*>(Supplement<Page>::from(page, supplementName())); }
    5958    static bool isActiveAt(Page*);
    6059
  • trunk/Source/WebCore/dom/DeviceOrientationController.cpp

    r108608 r108958  
    153153void provideDeviceOrientationTo(Page* page, DeviceOrientationClient* client)
    154154{
    155     PageSupplement::provideTo(page, DeviceOrientationController::supplementName(), DeviceOrientationController::create(page, client));
     155    DeviceOrientationController::provideTo(page, DeviceOrientationController::supplementName(), DeviceOrientationController::create(page, client));
    156156}
    157157
  • trunk/Source/WebCore/dom/DeviceOrientationController.h

    r107518 r108958  
    2828
    2929#include "DOMWindow.h"
    30 #include "PageSupplement.h"
     30#include "Page.h"
    3131#include "Timer.h"
    3232
     
    3737class DeviceOrientation;
    3838class DeviceOrientationClient;
    39 class Page;
    4039
    41 class DeviceOrientationController : public PageSupplement {
     40class DeviceOrientationController : public Supplement<Page> {
    4241public:
    4342    ~DeviceOrientationController();
     
    5958
    6059    static const AtomicString& supplementName();
    61     static DeviceOrientationController* from(Frame* frame) { return static_cast<DeviceOrientationController*>(PageSupplement::from(frame, supplementName())); }
    62     static DeviceOrientationController* from(Page* page) { return static_cast<DeviceOrientationController*>(PageSupplement::from(page, supplementName())); }
     60    static DeviceOrientationController* from(Page* page) { return static_cast<DeviceOrientationController*>(Supplement<Page>::from(page, supplementName())); }
    6361    static bool isActiveAt(Page*);
    6462
  • trunk/Source/WebCore/notifications/NotificationController.cpp

    r108615 r108958  
    6666void provideNotification(Page* page, NotificationPresenter* client)
    6767{
    68     PageSupplement::provideTo(page, NotificationController::supplementName(), NotificationController::create(page, client));
     68    NotificationController::provideTo(page, NotificationController::supplementName(), NotificationController::create(page, client));
    6969}
    7070
  • trunk/Source/WebCore/notifications/NotificationController.h

    r108615 r108958  
    2929#if ENABLE(NOTIFICATIONS)
    3030
    31 #include "PageSupplement.h"
     31#include "Page.h"
    3232#include <wtf/Forward.h>
    3333#include <wtf/Noncopyable.h>
     
    3636
    3737class NotificationPresenter;
    38 class Page;
    3938
    40 class NotificationController : public PageSupplement {
     39class NotificationController : public Supplement<Page> {
    4140    WTF_MAKE_NONCOPYABLE(NotificationController);
    4241public:
     
    4544    static PassOwnPtr<NotificationController> create(Page*, NotificationPresenter*);
    4645    static const AtomicString& supplementName();
    47     static NotificationController* from(Frame* frame) { return static_cast<NotificationController*>(PageSupplement::from(frame, supplementName())); }
    48     static NotificationController* from(Page* page) { return static_cast<NotificationController*>(PageSupplement::from(page, supplementName())); }
     46    static NotificationController* from(Page* page) { return static_cast<NotificationController*>(Supplement<Page>::from(page, supplementName())); }
    4947    static NotificationPresenter* clientFrom(Page*);
    5048
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r108700 r108958  
    464464}
    465465
     466Page* DOMWindow::page()
     467{
     468    return frame() ? frame()->page() : 0;
     469}
     470
    466471void DOMWindow::frameDestroyed()
    467472{
     
    14951500#if ENABLE(DEVICE_ORIENTATION)
    14961501    else if (eventType == eventNames().devicemotionEvent) {
    1497         if (DeviceMotionController* controller = DeviceMotionController::from(frame()))
     1502        if (DeviceMotionController* controller = DeviceMotionController::from(page()))
    14981503            controller->addListener(this);
    14991504    } else if (eventType == eventNames().deviceorientationEvent) {
    1500         if (DeviceOrientationController* controller = DeviceOrientationController::from(frame()))
     1505        if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    15011506            controller->addListener(this);
    15021507    }
     
    15221527#if ENABLE(DEVICE_ORIENTATION)
    15231528    else if (eventType == eventNames().devicemotionEvent) {
    1524         if (DeviceMotionController* controller = DeviceMotionController::from(frame()))
     1529        if (DeviceMotionController* controller = DeviceMotionController::from(page()))
    15251530            controller->removeListener(this);
    15261531    } else if (eventType == eventNames().deviceorientationEvent) {
    1527         if (DeviceOrientationController* controller = DeviceOrientationController::from(frame()))
     1532        if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    15281533            controller->removeListener(this);
    15291534    }
     
    15801585
    15811586#if ENABLE(DEVICE_ORIENTATION)
    1582     if (DeviceMotionController* controller = DeviceMotionController::from(frame()))
     1587    if (DeviceMotionController* controller = DeviceMotionController::from(page()))
    15831588        controller->removeAllListeners(this);
    1584     if (DeviceOrientationController* controller = DeviceOrientationController::from(frame()))
     1589    if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    15851590        controller->removeAllListeners(this);
    15861591#endif
  • trunk/Source/WebCore/page/DOMWindow.h

    r108603 r108958  
    5757    class Node;
    5858    class NotificationCenter;
     59    class Page;
    5960    class Performance;
    6061    class PostMessageTimer;
     
    401402        explicit DOMWindow(Frame*);
    402403
     404        Page* page();
     405
    403406        virtual void frameDestroyed() OVERRIDE;
    404407        virtual void willDetachPage() OVERRIDE;
  • trunk/Source/WebCore/page/Navigator.cpp

    r108450 r108958  
    5050Navigator::~Navigator()
    5151{
    52 }
    53 
    54 void Navigator::provideSupplement(const AtomicString& name, PassOwnPtr<NavigatorSupplement> supplement)
    55 {
    56     ASSERT(!m_suppliments.get(name.impl()));
    57     m_suppliments.set(name.impl(), supplement);
    58 }
    59 
    60 NavigatorSupplement* Navigator::requireSupplement(const AtomicString& name)
    61 {
    62     return m_suppliments.get(name.impl());
    6352}
    6453
  • trunk/Source/WebCore/page/Navigator.h

    r108450 r108958  
    2323#include "DOMWindowProperty.h"
    2424#include "NavigatorBase.h"
    25 #include "NavigatorSupplement.h"
     25#include "Supplementable.h"
    2626#include <wtf/Forward.h>
    2727#include <wtf/HashMap.h>
     
    4040typedef int ExceptionCode;
    4141
    42 class Navigator : public NavigatorBase, public RefCounted<Navigator>, public DOMWindowProperty {
     42class Navigator : public NavigatorBase, public RefCounted<Navigator>, public DOMWindowProperty, public Supplementable<Navigator> {
    4343public:
    4444    static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); }
     
    6161    void getStorageUpdates();
    6262
    63     void provideSupplement(const AtomicString&, PassOwnPtr<NavigatorSupplement>);
    64     NavigatorSupplement* requireSupplement(const AtomicString&);
    65 
    6663private:
    6764    explicit Navigator(Frame*);
    68 
    69     typedef HashMap<AtomicStringImpl*, OwnPtr<NavigatorSupplement> > NavigatorSupplementMap;
    70     NavigatorSupplementMap m_suppliments;
    7165
    7266    mutable RefPtr<DOMPluginArray> m_plugins;
  • trunk/Source/WebCore/page/Page.cpp

    r108615 r108958  
    10501050}
    10511051
    1052 void Page::provideSupplement(const AtomicString& name, PassOwnPtr<PageSupplement> supplement)
    1053 {
    1054     ASSERT(!m_supplements.get(name.impl()));
    1055     m_supplements.set(name.impl(), supplement);
    1056 }
    1057 
    1058 PageSupplement* Page::requireSupplement(const AtomicString& name)
    1059 {
    1060     return m_supplements.get(name.impl());
    1061 }
    1062 
    10631052Page::PageClients::PageClients()
    10641053    : chromeClient(0)
  • trunk/Source/WebCore/page/Page.h

    r108615 r108958  
    2525#include "FindOptions.h"
    2626#include "LayoutTypes.h"
    27 #include "PageSupplement.h"
    2827#include "PageVisibilityState.h"
    2928#include "PlatformScreen.h"
    3029#include "PlatformString.h"
     30#include "Supplementable.h"
    3131#include "ViewportArguments.h"
    3232#include <wtf/Forward.h>
     
    9090    float deviceScaleFactor(Frame*);
    9191
    92     class Page {
     92    class Page : public Supplementable<Page> {
    9393        WTF_MAKE_NONCOPYABLE(Page);
    9494        friend class Settings;
     
    325325        void addRelevantRepaintedObject(RenderObject*, const IntRect& objectPaintRect);
    326326
    327         void provideSupplement(const AtomicString&, PassOwnPtr<PageSupplement>);
    328         PageSupplement* requireSupplement(const AtomicString&);
    329 
    330327    private:
    331328        void initGroup();
    332 
    333         typedef HashMap<AtomicStringImpl*, OwnPtr<PageSupplement> > PageSupplementMap;
    334         PageSupplementMap m_supplements;
    335329
    336330#if ASSERT_DISABLED
  • trunk/Source/WebCore/page/SpeechInput.cpp

    r108446 r108958  
    126126void provideSpeechInputTo(Page* page, SpeechInputClient* client)
    127127{
    128     PageSupplement::provideTo(page, SpeechInput::supplementName(), SpeechInput::create(client));
     128    SpeechInput::provideTo(page, SpeechInput::supplementName(), SpeechInput::create(client));
    129129}
    130130
  • trunk/Source/WebCore/page/SpeechInput.h

    r108446 r108958  
    3434#if ENABLE(INPUT_SPEECH)
    3535
    36 #include "PageSupplement.h"
     36#include "Page.h"
    3737#include "SpeechInputListener.h"
    3838#include <wtf/Forward.h>
     
    5050// recognition and methods for the speech recognition engine to return back the results.
    5151class SpeechInput : public SpeechInputListener,
    52                     public PageSupplement {
     52                    public Supplement<Page> {
    5353    WTF_MAKE_NONCOPYABLE(SpeechInput);
    5454public:
     
    5757    static PassOwnPtr<SpeechInput> create(SpeechInputClient*);
    5858    static const AtomicString& supplementName();
    59     static SpeechInput* from(Frame* frame) { return static_cast<SpeechInput*>(PageSupplement::from(frame, supplementName())); }
    60     static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(PageSupplement::from(page, supplementName())); }
     59    static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supplement<Page>::from(page, supplementName())); }
    6160
    6261    // Generates a unique ID for the given listener to be used for speech requests.
Note: See TracChangeset for help on using the changeset viewer.