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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 1652483002: Browser Side Text Input State Tracking for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged Created 4 years, 8 months 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/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/build_info.h" 10 #include "base/android/build_info.h"
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 645
646 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { 646 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) {
647 // Do nothing. The UI notification is handled through ContentViewClient which 647 // Do nothing. The UI notification is handled through ContentViewClient which
648 // is TabContentsDelegate. 648 // is TabContentsDelegate.
649 } 649 }
650 650
651 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() { 651 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() {
652 return reinterpret_cast<intptr_t>(&ime_adapter_android_); 652 return reinterpret_cast<intptr_t>(&ime_adapter_android_);
653 } 653 }
654 654
655 void RenderWidgetHostViewAndroid::TextInputStateChanged( 655 void RenderWidgetHostViewAndroid::UpdateInputMethodIfNecessary(
656 const ViewHostMsg_TextInputState_Params& params) { 656 bool text_input_state_changed) {
657 if (params.is_non_ime_change) { 657 DCHECK(text_input_state_changed);
658 // Sends an acknowledgement to the renderer of a processed IME event.
659 host_->Send(new InputMsg_ImeEventAck(host_->GetRoutingID()));
660 }
661
662 if (!content_view_core_) 658 if (!content_view_core_)
663 return; 659 return;
664 660
661 const TextInputState* state = host_->delegate()->GetTextInputState();
662
665 content_view_core_->UpdateImeAdapter( 663 content_view_core_->UpdateImeAdapter(
666 GetNativeImeAdapter(), 664 GetNativeImeAdapter(), static_cast<int>(state->type), state->flags,
667 static_cast<int>(params.type), params.flags, 665 state->value, state->selection_start, state->selection_end,
668 params.value, params.selection_start, params.selection_end, 666 state->composition_start, state->composition_end,
669 params.composition_start, params.composition_end, 667 state->show_ime_if_needed, state->is_non_ime_change);
670 params.show_ime_if_needed, params.is_non_ime_change);
671 } 668 }
672 669
673 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { 670 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) {
674 if (cached_background_color_ == color) 671 if (cached_background_color_ == color)
675 return; 672 return;
676 673
677 cached_background_color_ = color; 674 cached_background_color_ = color;
678 if (content_view_core_) 675 if (content_view_core_)
679 content_view_core_->OnBackgroundColorChanged(color); 676 content_view_core_->OnBackgroundColorChanged(color);
680 } 677 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 RemoveLayers(); 803 RemoveLayers();
807 SetContentViewCore(NULL); 804 SetContentViewCore(NULL);
808 805
809 if (!surface_id_.is_null()) { 806 if (!surface_id_.is_null()) {
810 DCHECK(surface_factory_.get()); 807 DCHECK(surface_factory_.get());
811 surface_factory_->Destroy(surface_id_); 808 surface_factory_->Destroy(surface_id_);
812 surface_id_ = cc::SurfaceId(); 809 surface_id_ = cc::SurfaceId();
813 } 810 }
814 surface_factory_.reset(); 811 surface_factory_.reset();
815 812
813 // The WebContentsImpl should be notified about us so that it will not hold
814 // an invalid text input state which was due to active text on this view.
815 NotifyHostDelegateAboutShutdown();
816
816 // The RenderWidgetHost's destruction led here, so don't call it. 817 // The RenderWidgetHost's destruction led here, so don't call it.
817 host_ = NULL; 818 host_ = NULL;
818 819
819 delete this; 820 delete this;
820 } 821 }
821 822
822 void RenderWidgetHostViewAndroid::SetTooltipText( 823 void RenderWidgetHostViewAndroid::SetTooltipText(
823 const base::string16& tooltip_text) { 824 const base::string16& tooltip_text) {
824 // Tooltips don't makes sense on Android. 825 // Tooltips don't makes sense on Android.
825 } 826 }
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 results->orientationAngle = display.RotationAsDegree(); 2018 results->orientationAngle = display.RotationAsDegree();
2018 results->orientationType = 2019 results->orientationType =
2019 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 2020 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
2020 gfx::DeviceDisplayInfo info; 2021 gfx::DeviceDisplayInfo info;
2021 results->depth = info.GetBitsPerPixel(); 2022 results->depth = info.GetBitsPerPixel();
2022 results->depthPerComponent = info.GetBitsPerComponent(); 2023 results->depthPerComponent = info.GetBitsPerComponent();
2023 results->isMonochrome = (results->depthPerComponent == 0); 2024 results->isMonochrome = (results->depthPerComponent == 0);
2024 } 2025 }
2025 2026
2026 } // namespace content 2027 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698