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

Side by Side Diff: content/browser/web_contents/web_contents_view_android.cc

Issue 2528823002: Separate SwipeRefreshHandler and ContentViewCore (Closed)
Patch Set: tedchoc's requested changes Created 4 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/web_contents/web_contents_view_android.h" 5 #include "content/browser/web_contents/web_contents_view_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
11 #include "content/browser/android/content_view_core_impl.h" 11 #include "content/browser/android/content_view_core_impl.h"
12 #include "content/browser/frame_host/interstitial_page_impl.h" 12 #include "content/browser/frame_host/interstitial_page_impl.h"
13 #include "content/browser/renderer_host/render_widget_host_view_android.h" 13 #include "content/browser/renderer_host/render_widget_host_view_android.h"
14 #include "content/browser/renderer_host/render_view_host_factory.h" 14 #include "content/browser/renderer_host/render_view_host_factory.h"
15 #include "content/browser/renderer_host/render_view_host_impl.h" 15 #include "content/browser/renderer_host/render_view_host_impl.h"
16 #include "content/browser/web_contents/web_contents_impl.h" 16 #include "content/browser/web_contents/web_contents_impl.h"
17 #include "content/public/browser/render_widget_host.h" 17 #include "content/public/browser/render_widget_host.h"
18 #include "content/public/browser/web_contents_delegate.h" 18 #include "content/public/browser/web_contents_delegate.h"
19 #include "content/public/common/drop_data.h" 19 #include "content/public/common/drop_data.h"
20 #include "ui/android/overscroll_refresh_handler.h"
20 #include "ui/display/screen.h" 21 #include "ui/display/screen.h"
21 #include "ui/gfx/android/device_display_info.h" 22 #include "ui/gfx/android/device_display_info.h"
22 #include "ui/gfx/android/java_bitmap.h" 23 #include "ui/gfx/android/java_bitmap.h"
23 #include "ui/gfx/image/image_skia.h" 24 #include "ui/gfx/image/image_skia.h"
24 25
25 using base::android::AttachCurrentThread; 26 using base::android::AttachCurrentThread;
26 using base::android::ConvertUTF16ToJavaString; 27 using base::android::ConvertUTF16ToJavaString;
27 using base::android::JavaRef; 28 using base::android::JavaRef;
28 using base::android::ScopedJavaLocalRef; 29 using base::android::ScopedJavaLocalRef;
29 30
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 web_contents_->GetInterstitialPage() 105 web_contents_->GetInterstitialPage()
105 ->GetMainFrame() 106 ->GetMainFrame()
106 ->GetRenderViewHost() 107 ->GetRenderViewHost()
107 ->GetWidget() 108 ->GetWidget()
108 ->GetView()); 109 ->GetView());
109 if (rwhv) 110 if (rwhv)
110 rwhv->SetContentViewCore(content_view_core_); 111 rwhv->SetContentViewCore(content_view_core_);
111 } 112 }
112 } 113 }
113 114
115 void WebContentsViewAndroid::SetOverscrollRefreshHandler(
116 std::unique_ptr<ui::OverscrollRefreshHandler> overscroll_refresh_handler) {
117 overscroll_refresh_handler_ = std::move(overscroll_refresh_handler);
118 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>(
119 web_contents_->GetRenderWidgetHostView());
120 if (rwhv)
121 rwhv->OnOverscrollRefreshHandlerAvailable();
122
123 if (web_contents_->ShowingInterstitialPage()) {
124 rwhv = static_cast<RenderWidgetHostViewAndroid*>(
125 web_contents_->GetInterstitialPage()
126 ->GetMainFrame()
127 ->GetRenderViewHost()
128 ->GetWidget()
129 ->GetView());
130 if (rwhv)
131 rwhv->OnOverscrollRefreshHandlerAvailable();
132 }
133 }
134
135 ui::OverscrollRefreshHandler*
136 WebContentsViewAndroid::GetOverscrollRefreshHandler() const {
137 return overscroll_refresh_handler_.get();
138 }
139
114 gfx::NativeView WebContentsViewAndroid::GetNativeView() const { 140 gfx::NativeView WebContentsViewAndroid::GetNativeView() const {
115 return const_cast<gfx::NativeView>(&view_); 141 return const_cast<gfx::NativeView>(&view_);
116 } 142 }
117 143
118 gfx::NativeView WebContentsViewAndroid::GetContentNativeView() const { 144 gfx::NativeView WebContentsViewAndroid::GetContentNativeView() const {
119 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); 145 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
120 if (rwhv) 146 if (rwhv)
121 return rwhv->GetNativeView(); 147 return rwhv->GetNativeView();
122 148
123 // TODO(sievers): This should return null. 149 // TODO(sievers): This should return null.
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // This is called when we the renderer asks us to take focus back (i.e., it has 390 // This is called when we the renderer asks us to take focus back (i.e., it has
365 // iterated past the last focusable element on the page). 391 // iterated past the last focusable element on the page).
366 void WebContentsViewAndroid::TakeFocus(bool reverse) { 392 void WebContentsViewAndroid::TakeFocus(bool reverse) {
367 if (web_contents_->GetDelegate() && 393 if (web_contents_->GetDelegate() &&
368 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) 394 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse))
369 return; 395 return;
370 web_contents_->GetRenderWidgetHostView()->Focus(); 396 web_contents_->GetRenderWidgetHostView()->Focus();
371 } 397 }
372 398
373 } // namespace content 399 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_android.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698