| OLD | NEW |
| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/android/content_view_core_impl.h" | 8 #include "content/browser/android/content_view_core_impl.h" |
| 9 #include "content/browser/android/media_player_manager_android.h" | 9 #include "content/browser/android/media_player_manager_android.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 10 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 11 #include "content/browser/renderer_host/render_view_host_factory.h" | 11 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 12 #include "content/browser/renderer_host/render_view_host_impl.h" | 12 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 13 #include "content/browser/web_contents/interstitial_page_impl.h" |
| 13 #include "content/browser/web_contents/web_contents_impl.h" | 14 #include "content/browser/web_contents/web_contents_impl.h" |
| 14 #include "content/public/browser/interstitial_page.h" | |
| 15 #include "content/public/browser/web_contents_delegate.h" | 15 #include "content/public/browser/web_contents_delegate.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 WebContentsView* CreateWebContentsView( | 18 WebContentsView* CreateWebContentsView( |
| 19 WebContentsImpl* web_contents, | 19 WebContentsImpl* web_contents, |
| 20 WebContentsViewDelegate* delegate, | 20 WebContentsViewDelegate* delegate, |
| 21 RenderViewHostDelegateView** render_view_host_delegate_view) { | 21 RenderViewHostDelegateView** render_view_host_delegate_view) { |
| 22 WebContentsViewAndroid* rv = new WebContentsViewAndroid( | 22 WebContentsViewAndroid* rv = new WebContentsViewAndroid( |
| 23 web_contents, delegate); | 23 web_contents, delegate); |
| 24 *render_view_host_delegate_view = rv; | 24 *render_view_host_delegate_view = rv; |
| 25 return rv; | 25 return rv; |
| 26 } | 26 } |
| 27 | 27 |
| 28 WebContentsViewAndroid::WebContentsViewAndroid( | 28 WebContentsViewAndroid::WebContentsViewAndroid( |
| 29 WebContentsImpl* web_contents, | 29 WebContentsImpl* web_contents, |
| 30 WebContentsViewDelegate* delegate) | 30 WebContentsViewDelegate* delegate) |
| 31 : web_contents_(web_contents), | 31 : web_contents_(web_contents), |
| 32 content_view_core_(NULL), | 32 content_view_core_(NULL), |
| 33 delegate_(delegate) { | 33 delegate_(delegate) { |
| 34 } | 34 } |
| 35 | 35 |
| 36 WebContentsViewAndroid::~WebContentsViewAndroid() { | 36 WebContentsViewAndroid::~WebContentsViewAndroid() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 void WebContentsViewAndroid::SetContentViewCore( | 39 void WebContentsViewAndroid::SetContentViewCore( |
| 40 ContentViewCoreImpl* content_view_core) { | 40 ContentViewCoreImpl* content_view_core) { |
| 41 content_view_core_ = content_view_core; | 41 content_view_core_ = content_view_core; |
| 42 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( | 42 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
| 43 web_contents_->GetRenderWidgetHostView()); | |
| 44 if (rwhv) | |
| 45 rwhv->SetContentViewCore(content_view_core_); | |
| 46 if (web_contents_->ShowingInterstitialPage()) { | 43 if (web_contents_->ShowingInterstitialPage()) { |
| 47 NOTIMPLEMENTED() << "not upstreamed yet"; | 44 rwhv = static_cast<InterstitialPageImpl*>( |
| 45 web_contents_->GetInterstitialPage())-> |
| 46 GetRenderViewHost()->GetView(); |
| 47 } |
| 48 if (rwhv) { |
| 49 static_cast<RenderWidgetHostViewAndroid*>(rwhv)-> |
| 50 SetContentViewCore(content_view_core_); |
| 48 } | 51 } |
| 49 } | 52 } |
| 50 | 53 |
| 51 void WebContentsViewAndroid::CreateView(const gfx::Size& initial_size) { | 54 void WebContentsViewAndroid::CreateView(const gfx::Size& initial_size) { |
| 52 } | 55 } |
| 53 | 56 |
| 54 RenderWidgetHostView* WebContentsViewAndroid::CreateViewForWidget( | 57 RenderWidgetHostView* WebContentsViewAndroid::CreateViewForWidget( |
| 55 RenderWidgetHost* render_widget_host) { | 58 RenderWidgetHost* render_widget_host) { |
| 56 if (render_widget_host->GetView()) { | 59 if (render_widget_host->GetView()) { |
| 57 // During testing, the view will already be set up in most cases to the | 60 // During testing, the view will already be set up in most cases to the |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // This is called when we the renderer asks us to take focus back (i.e., it has | 202 // This is called when we the renderer asks us to take focus back (i.e., it has |
| 200 // iterated past the last focusable element on the page). | 203 // iterated past the last focusable element on the page). |
| 201 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 204 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
| 202 if (web_contents_->GetDelegate() && | 205 if (web_contents_->GetDelegate() && |
| 203 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 206 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
| 204 return; | 207 return; |
| 205 web_contents_->GetRenderWidgetHostView()->Focus(); | 208 web_contents_->GetRenderWidgetHostView()->Focus(); |
| 206 } | 209 } |
| 207 | 210 |
| 208 } // namespace content | 211 } // namespace content |
| OLD | NEW |