| 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/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" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 void WebContentsViewAndroid::SizeContents(const gfx::Size& size) { | 124 void WebContentsViewAndroid::SizeContents(const gfx::Size& size) { |
| 125 // TODO(klobag): Do we need to do anything else? | 125 // TODO(klobag): Do we need to do anything else? |
| 126 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); | 126 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
| 127 if (rwhv) | 127 if (rwhv) |
| 128 rwhv->SetSize(size); | 128 rwhv->SetSize(size); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void WebContentsViewAndroid::Focus() { | 131 void WebContentsViewAndroid::Focus() { |
| 132 if (web_contents_->ShowingInterstitialPage()) | 132 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( |
| 133 web_contents_->GetRenderWidgetHostView()); |
| 134 if (web_contents_->ShowingInterstitialPage()) { |
| 133 web_contents_->GetInterstitialPage()->Focus(); | 135 web_contents_->GetInterstitialPage()->Focus(); |
| 134 else | 136 if (content_view_core_) |
| 135 web_contents_->GetRenderWidgetHostView()->Focus(); | 137 content_view_core_->ForceUpdateImeAdapter(rwhv->GetNativeImeAdapter()); |
| 138 } else { |
| 139 rwhv->Focus(); |
| 140 } |
| 136 } | 141 } |
| 137 | 142 |
| 138 void WebContentsViewAndroid::SetInitialFocus() { | 143 void WebContentsViewAndroid::SetInitialFocus() { |
| 139 if (web_contents_->FocusLocationBarByDefault()) | 144 if (web_contents_->FocusLocationBarByDefault()) |
| 140 web_contents_->SetFocusToLocationBar(false); | 145 web_contents_->SetFocusToLocationBar(false); |
| 141 else | 146 else |
| 142 Focus(); | 147 Focus(); |
| 143 } | 148 } |
| 144 | 149 |
| 145 void WebContentsViewAndroid::StoreFocus() { | 150 void WebContentsViewAndroid::StoreFocus() { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 // This is called when we the renderer asks us to take focus back (i.e., it has | 328 // This is called when we the renderer asks us to take focus back (i.e., it has |
| 324 // iterated past the last focusable element on the page). | 329 // iterated past the last focusable element on the page). |
| 325 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 330 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
| 326 if (web_contents_->GetDelegate() && | 331 if (web_contents_->GetDelegate() && |
| 327 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 332 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
| 328 return; | 333 return; |
| 329 web_contents_->GetRenderWidgetHostView()->Focus(); | 334 web_contents_->GetRenderWidgetHostView()->Focus(); |
| 330 } | 335 } |
| 331 | 336 |
| 332 } // namespace content | 337 } // namespace content |
| OLD | NEW |