OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
43 #include "core/html/HTMLFrameElementBase.h" | 43 #include "core/html/HTMLFrameElementBase.h" |
44 #include "core/html/HTMLMediaElement.h" | 44 #include "core/html/HTMLMediaElement.h" |
45 #include "core/html/HTMLPlugInElement.h" | 45 #include "core/html/HTMLPlugInElement.h" |
46 #include "core/input/EventHandler.h" | 46 #include "core/input/EventHandler.h" |
47 #include "core/layout/HitTestResult.h" | 47 #include "core/layout/HitTestResult.h" |
48 #include "core/loader/DocumentLoader.h" | 48 #include "core/loader/DocumentLoader.h" |
49 #include "core/loader/FrameLoadRequest.h" | 49 #include "core/loader/FrameLoadRequest.h" |
50 #include "core/loader/FrameLoader.h" | 50 #include "core/loader/FrameLoader.h" |
51 #include "core/loader/HistoryItem.h" | 51 #include "core/loader/HistoryItem.h" |
52 #include "core/loader/LinkLoaderClient.h" | |
52 #include "core/page/Page.h" | 53 #include "core/page/Page.h" |
53 #include "core/page/WindowFeatures.h" | 54 #include "core/page/WindowFeatures.h" |
54 #include "modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.h" | 55 #include "modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.h" |
55 #include "modules/device_light/DeviceLightController.h" | 56 #include "modules/device_light/DeviceLightController.h" |
56 #include "modules/device_orientation/DeviceMotionController.h" | 57 #include "modules/device_orientation/DeviceMotionController.h" |
57 #include "modules/device_orientation/DeviceOrientationAbsoluteController.h" | 58 #include "modules/device_orientation/DeviceOrientationAbsoluteController.h" |
58 #include "modules/device_orientation/DeviceOrientationController.h" | 59 #include "modules/device_orientation/DeviceOrientationController.h" |
59 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" | 60 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" |
60 #include "modules/gamepad/NavigatorGamepad.h" | 61 #include "modules/gamepad/NavigatorGamepad.h" |
61 #include "modules/mediasession/HTMLMediaElementMediaSession.h" | 62 #include "modules/mediasession/HTMLMediaElementMediaSession.h" |
62 #include "modules/mediasession/MediaSession.h" | 63 #include "modules/mediasession/MediaSession.h" |
63 #include "modules/serviceworkers/NavigatorServiceWorker.h" | 64 #include "modules/serviceworkers/NavigatorServiceWorker.h" |
65 #include "modules/serviceworkers/ServiceWorkerContainer.h" | |
64 #include "modules/storage/DOMWindowStorageController.h" | 66 #include "modules/storage/DOMWindowStorageController.h" |
65 #include "modules/vr/NavigatorVRDevice.h" | 67 #include "modules/vr/NavigatorVRDevice.h" |
66 #include "platform/Histogram.h" | 68 #include "platform/Histogram.h" |
67 #include "platform/MIMETypeRegistry.h" | 69 #include "platform/MIMETypeRegistry.h" |
68 #include "platform/RuntimeEnabledFeatures.h" | 70 #include "platform/RuntimeEnabledFeatures.h" |
69 #include "platform/UserGestureIndicator.h" | 71 #include "platform/UserGestureIndicator.h" |
70 #include "platform/exported/WrappedResourceRequest.h" | 72 #include "platform/exported/WrappedResourceRequest.h" |
71 #include "platform/exported/WrappedResourceResponse.h" | 73 #include "platform/exported/WrappedResourceResponse.h" |
72 #include "platform/fonts/GlyphPageTreeNode.h" | 74 #include "platform/fonts/GlyphPageTreeNode.h" |
73 #include "platform/network/HTTPParsers.h" | 75 #include "platform/network/HTTPParsers.h" |
74 #include "platform/plugins/PluginData.h" | 76 #include "platform/plugins/PluginData.h" |
75 #include "public/platform/Platform.h" | 77 #include "public/platform/Platform.h" |
76 #include "public/platform/WebApplicationCacheHost.h" | 78 #include "public/platform/WebApplicationCacheHost.h" |
77 #include "public/platform/WebMediaPlayer.h" | 79 #include "public/platform/WebMediaPlayer.h" |
78 #include "public/platform/WebMimeRegistry.h" | 80 #include "public/platform/WebMimeRegistry.h" |
79 #include "public/platform/WebRTCPeerConnectionHandler.h" | 81 #include "public/platform/WebRTCPeerConnectionHandler.h" |
82 #include "public/platform/WebScheduler.h" | |
80 #include "public/platform/WebSecurityOrigin.h" | 83 #include "public/platform/WebSecurityOrigin.h" |
81 #include "public/platform/WebURL.h" | 84 #include "public/platform/WebURL.h" |
82 #include "public/platform/WebURLError.h" | 85 #include "public/platform/WebURLError.h" |
83 #include "public/platform/WebVector.h" | 86 #include "public/platform/WebVector.h" |
84 #include "public/platform/modules/mediasession/WebMediaSession.h" | 87 #include "public/platform/modules/mediasession/WebMediaSession.h" |
85 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 88 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
86 #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h " | 89 #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h " |
87 #include "public/web/WebAutofillClient.h" | 90 #include "public/web/WebAutofillClient.h" |
88 #include "public/web/WebContentSettingsClient.h" | 91 #include "public/web/WebContentSettingsClient.h" |
89 #include "public/web/WebDOMEvent.h" | 92 #include "public/web/WebDOMEvent.h" |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1030 } | 1033 } |
1031 | 1034 |
1032 void FrameLoaderClientImpl::suddenTerminationDisablerChanged(bool present, Sudde nTerminationDisablerType type) | 1035 void FrameLoaderClientImpl::suddenTerminationDisablerChanged(bool present, Sudde nTerminationDisablerType type) |
1033 { | 1036 { |
1034 if (m_webFrame->client()) { | 1037 if (m_webFrame->client()) { |
1035 m_webFrame->client()->suddenTerminationDisablerChanged( | 1038 m_webFrame->client()->suddenTerminationDisablerChanged( |
1036 present, static_cast<WebFrameClient::SuddenTerminationDisablerType>( type)); | 1039 present, static_cast<WebFrameClient::SuddenTerminationDisablerType>( type)); |
1037 } | 1040 } |
1038 } | 1041 } |
1039 | 1042 |
1043 namespace { | |
1044 | |
1045 class RegistrationCallback : public WebServiceWorkerProvider::WebServiceWorkerRe gistrationCallbacks { | |
1046 public: | |
1047 explicit RegistrationCallback(LinkLoaderClient* client) : m_client(client) { } | |
1048 ~RegistrationCallback() override {} | |
1049 | |
1050 void onSuccess(WebPassOwnPtr<WebServiceWorkerRegistration::Handle> handle) o verride | |
1051 { | |
1052 Platform::current()->currentThread()->scheduler()->timerTaskRunner()->po stTask(BLINK_FROM_HERE, bind(&LinkLoaderClient::linkLoaded, m_client)); | |
1053 } | |
1054 | |
1055 void onError(const WebServiceWorkerError& error) override | |
1056 { | |
1057 Platform::current()->currentThread()->scheduler()->timerTaskRunner()->po stTask(BLINK_FROM_HERE, bind(&LinkLoaderClient::linkLoadingErrored, m_client)); | |
1058 } | |
1059 | |
1060 private: | |
1061 WTF_MAKE_NONCOPYABLE(RegistrationCallback); | |
1062 | |
1063 RawPtrWillBePersistent<LinkLoaderClient> m_client; | |
1064 }; | |
1065 | |
1066 } | |
1067 | |
1068 void FrameLoaderClientImpl::registerServiceWorker(const KURL& scriptURL, const S tring& scope, LinkLoaderClient* client) | |
1069 { | |
1070 if (!client->shouldLoadLink()) | |
1071 return; | |
1072 | |
1073 Document* document = m_webFrame->frame()->document(); | |
1074 KURL scopeURL; | |
1075 if (scope.isNull()) | |
1076 scopeURL = KURL(scriptURL, "./"); | |
1077 else | |
1078 scopeURL = document->completeURL(scope); | |
1079 scopeURL.removeFragmentIdentifier(); | |
Nate Chapin
2016/03/17 22:49:03
Can we do this and the things about it in LinkServ
Marijn Kruisselbrink
2016/03/17 23:20:39
Done
| |
1080 | |
1081 TrackExceptionState exceptionState; | |
1082 NavigatorServiceWorker::serviceWorker(document, *m_webFrame->frame()->domWin dow()->navigator(), exceptionState)->registerServiceWorkerImpl(document, scriptU RL, scopeURL, adoptPtr(new RegistrationCallback(client))); | |
1083 } | |
1084 | |
1040 } // namespace blink | 1085 } // namespace blink |
OLD | NEW |