| 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/frame_host/interstitial_page_impl.h" | 9 #include "content/browser/frame_host/interstitial_page_impl.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" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 ->GetMainFrame() | 52 ->GetMainFrame() |
| 53 ->GetRenderViewHost() | 53 ->GetRenderViewHost() |
| 54 ->GetWidget() | 54 ->GetWidget() |
| 55 ->GetView()); | 55 ->GetView()); |
| 56 if (rwhv) | 56 if (rwhv) |
| 57 rwhv->SetContentViewCore(content_view_core_); | 57 rwhv->SetContentViewCore(content_view_core_); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 gfx::NativeView WebContentsViewAndroid::GetNativeView() const { | 61 gfx::NativeView WebContentsViewAndroid::GetNativeView() const { |
| 62 return content_view_core_ ? content_view_core_ : NULL; | 62 return content_view_core_ ? content_view_core_->GetViewAndroid() : nullptr; |
| 63 } | 63 } |
| 64 | 64 |
| 65 gfx::NativeView WebContentsViewAndroid::GetContentNativeView() const { | 65 gfx::NativeView WebContentsViewAndroid::GetContentNativeView() const { |
| 66 return content_view_core_ ? content_view_core_ : NULL; | 66 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
| 67 if (rwhv) |
| 68 return rwhv->GetNativeView(); |
| 69 |
| 70 // TODO(sievers): This should return null. |
| 71 return GetNativeView(); |
| 67 } | 72 } |
| 68 | 73 |
| 69 gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const { | 74 gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const { |
| 70 return content_view_core_ ? content_view_core_->GetWindowAndroid() : NULL; | 75 return content_view_core_ ? content_view_core_->GetWindowAndroid() : nullptr; |
| 71 } | 76 } |
| 72 | 77 |
| 73 void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const { | 78 void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const { |
| 74 *out = content_view_core_ ? gfx::Rect(content_view_core_->GetViewSize()) | 79 *out = content_view_core_ ? gfx::Rect(content_view_core_->GetViewSize()) |
| 75 : gfx::Rect(); | 80 : gfx::Rect(); |
| 76 } | 81 } |
| 77 | 82 |
| 78 void WebContentsViewAndroid::SetPageTitle(const base::string16& title) { | 83 void WebContentsViewAndroid::SetPageTitle(const base::string16& title) { |
| 79 if (content_view_core_) | 84 if (content_view_core_) |
| 80 content_view_core_->SetTitle(title); | 85 content_view_core_->SetTitle(title); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // This is called when we the renderer asks us to take focus back (i.e., it has | 240 // This is called when we the renderer asks us to take focus back (i.e., it has |
| 236 // iterated past the last focusable element on the page). | 241 // iterated past the last focusable element on the page). |
| 237 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 242 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
| 238 if (web_contents_->GetDelegate() && | 243 if (web_contents_->GetDelegate() && |
| 239 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 244 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
| 240 return; | 245 return; |
| 241 web_contents_->GetRenderWidgetHostView()->Focus(); | 246 web_contents_->GetRenderWidgetHostView()->Focus(); |
| 242 } | 247 } |
| 243 | 248 |
| 244 } // namespace content | 249 } // namespace content |
| OLD | NEW |