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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 553603002: [ServiceWorker] Introduce isControlledByServiceWorker() in content::RenderFrameImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: isControlledByServiceWorker Created 6 years, 3 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/alias.h" 12 #include "base/debug/alias.h"
13 #include "base/debug/asan_invalid_access.h" 13 #include "base/debug/asan_invalid_access.h"
14 #include "base/debug/dump_without_crashing.h" 14 #include "base/debug/dump_without_crashing.h"
15 #include "base/i18n/char_iterator.h" 15 #include "base/i18n/char_iterator.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/process/kill.h" 17 #include "base/process/kill.h"
18 #include "base/process/process.h" 18 #include "base/process/process.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "content/child/appcache/appcache_dispatcher.h" 22 #include "content/child/appcache/appcache_dispatcher.h"
23 #include "content/child/plugin_messages.h" 23 #include "content/child/plugin_messages.h"
24 #include "content/child/quota_dispatcher.h" 24 #include "content/child/quota_dispatcher.h"
25 #include "content/child/request_extra_data.h" 25 #include "content/child/request_extra_data.h"
26 #include "content/child/service_worker/service_worker_network_provider.h" 26 #include "content/child/service_worker/service_worker_network_provider.h"
27 #include "content/child/service_worker/service_worker_provider_context.h"
27 #include "content/child/service_worker/web_service_worker_provider_impl.h" 28 #include "content/child/service_worker/web_service_worker_provider_impl.h"
28 #include "content/child/web_socket_stream_handle_impl.h" 29 #include "content/child/web_socket_stream_handle_impl.h"
29 #include "content/child/web_url_request_util.h" 30 #include "content/child/web_url_request_util.h"
30 #include "content/child/webmessageportchannel_impl.h" 31 #include "content/child/webmessageportchannel_impl.h"
31 #include "content/child/websocket_bridge.h" 32 #include "content/child/websocket_bridge.h"
32 #include "content/child/weburlresponse_extradata_impl.h" 33 #include "content/child/weburlresponse_extradata_impl.h"
33 #include "content/common/clipboard_messages.h" 34 #include "content/common/clipboard_messages.h"
34 #include "content/common/frame_messages.h" 35 #include "content/common/frame_messages.h"
35 #include "content/common/input_messages.h" 36 #include "content/common/input_messages.h"
36 #include "content/common/service_worker/service_worker_types.h" 37 #include "content/common/service_worker/service_worker_types.h"
(...skipping 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 routing_id_, frame_rect, scale_factor)); 3182 routing_id_, frame_rect, scale_factor));
3182 } 3183 }
3183 3184
3184 blink::WebScreenOrientationClient* 3185 blink::WebScreenOrientationClient*
3185 RenderFrameImpl::webScreenOrientationClient() { 3186 RenderFrameImpl::webScreenOrientationClient() {
3186 if (!screen_orientation_dispatcher_) 3187 if (!screen_orientation_dispatcher_)
3187 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); 3188 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this);
3188 return screen_orientation_dispatcher_; 3189 return screen_orientation_dispatcher_;
3189 } 3190 }
3190 3191
3192 bool RenderFrameImpl::isControlledByServiceWorker() {
3193 // If we're in the middle of committing a load, the data source we need
3194 // will still be provisional.
3195 WebFrame* main_frame = render_view_->webview()->mainFrame();
3196 WebDataSource* data_source = NULL;
3197 if (main_frame->provisionalDataSource())
3198 data_source = main_frame->provisionalDataSource();
3199 else
3200 data_source = main_frame->dataSource();
3201 ServiceWorkerNetworkProvider* provider =
3202 ServiceWorkerNetworkProvider::FromDocumentState(
3203 DocumentState::FromDataSource(data_source));
3204 return provider->context()->controller_handle_id() !=
3205 kInvalidServiceWorkerHandleId;
3206 }
3207
3191 void RenderFrameImpl::DidPlay(blink::WebMediaPlayer* player) { 3208 void RenderFrameImpl::DidPlay(blink::WebMediaPlayer* player) {
3192 Send(new FrameHostMsg_MediaPlayingNotification( 3209 Send(new FrameHostMsg_MediaPlayingNotification(
3193 routing_id_, reinterpret_cast<int64>(player), player->hasVideo(), 3210 routing_id_, reinterpret_cast<int64>(player), player->hasVideo(),
3194 player->hasAudio())); 3211 player->hasAudio()));
3195 } 3212 }
3196 3213
3197 void RenderFrameImpl::DidPause(blink::WebMediaPlayer* player) { 3214 void RenderFrameImpl::DidPause(blink::WebMediaPlayer* player) {
3198 Send(new FrameHostMsg_MediaPausedNotification( 3215 Send(new FrameHostMsg_MediaPausedNotification(
3199 routing_id_, reinterpret_cast<int64>(player))); 3216 routing_id_, reinterpret_cast<int64>(player)));
3200 } 3217 }
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 3898
3882 #if defined(ENABLE_BROWSER_CDMS) 3899 #if defined(ENABLE_BROWSER_CDMS)
3883 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 3900 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
3884 if (!cdm_manager_) 3901 if (!cdm_manager_)
3885 cdm_manager_ = new RendererCdmManager(this); 3902 cdm_manager_ = new RendererCdmManager(this);
3886 return cdm_manager_; 3903 return cdm_manager_;
3887 } 3904 }
3888 #endif // defined(ENABLE_BROWSER_CDMS) 3905 #endif // defined(ENABLE_BROWSER_CDMS)
3889 3906
3890 } // namespace content 3907 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698