Chromium Code Reviews| Index: content/browser/android/content_view_core_impl.cc |
| diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
| index 7fb557f4dfb3adfdc5da9f4555ae18d057119b5f..655216b1d9a1d581e1a786b5d966c8aefafe10e2 100644 |
| --- a/content/browser/android/content_view_core_impl.cc |
| +++ b/content/browser/android/content_view_core_impl.cc |
| @@ -107,7 +107,8 @@ ScopedJavaLocalRef<jobject> CreateJavaRect( |
| static_cast<int>(rect.y()), |
| static_cast<int>(rect.right()), |
| static_cast<int>(rect.bottom()))); |
| -}; |
| +} |
| + |
| } // namespace |
| // Enables a callback when the underlying WebContents is destroyed, to enable |
| @@ -173,7 +174,8 @@ ContentViewCoreImpl::ContentViewCoreImpl(JNIEnv* env, jobject obj, |
| kDefaultVSyncIntervalMicros * kDefaultBrowserCompositeVSyncFraction)), |
| view_android_(view_android), |
| window_android_(window_android), |
| - device_orientation_(0) { |
| + device_orientation_(0), |
| + geolocation_needs_pause_(false) { |
| CHECK(web_contents) << |
| "A ContentViewCoreImpl should be created with a valid WebContents."; |
| @@ -263,6 +265,8 @@ void ContentViewCoreImpl::Observe(int type, |
| } |
| } |
| SetFocusInternal(HasFocus()); |
| + if (geolocation_needs_pause_) |
| + PauseOrResumeGeolocation(true); |
|
Michael van Ouwerkerk
2013/12/12 14:45:03
This line actually doesn't read well. Does 'true'
benm (inactive)
2013/12/12 18:24:04
Yeah, it's kinda clunky I agree... but when taken
|
| break; |
| } |
| case NOTIFICATION_RENDERER_PROCESS_CREATED: { |
| @@ -348,6 +352,26 @@ void ContentViewCoreImpl::PauseVideo() { |
| host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); |
| } |
| +void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) { |
| + geolocation_needs_pause_ = should_pause; |
| + RenderViewHostImpl* rvh = |
| + static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost()); |
| + if (rvh) { |
| + scoped_refptr<GeolocationDispatcherHost> geolocation_dispatcher = |
| + static_cast<RenderProcessHostImpl*>( |
| + web_contents_->GetRenderProcessHost())-> |
| + geolocation_dispatcher_host(); |
| + if (geolocation_dispatcher.get()) { |
| + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| + base::Bind(&GeolocationDispatcherHost::PauseOrResume, |
| + geolocation_dispatcher, |
| + rvh->GetRoutingID(), |
| + should_pause)); |
| + geolocation_needs_pause_ = false; |
| + } |
| + } |
| +} |
| + |
| void ContentViewCoreImpl::OnTabCrashed() { |
| JNIEnv* env = AttachCurrentThread(); |
| ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |