| 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/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 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 CreateOverscrollControllerIfPossible(); | 489 CreateOverscrollControllerIfPossible(); |
| 490 | 490 |
| 491 if (GetTextInputManager()) | 491 if (GetTextInputManager()) |
| 492 GetTextInputManager()->AddObserver(this); | 492 GetTextInputManager()->AddObserver(this); |
| 493 } | 493 } |
| 494 | 494 |
| 495 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { | 495 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { |
| 496 if (content_view_core_) | 496 if (content_view_core_) |
| 497 content_view_core_->RemoveObserver(this); | 497 content_view_core_->RemoveObserver(this); |
| 498 SetContentViewCore(NULL); | 498 SetContentViewCore(NULL); |
| 499 if (ime_adapter_android_) | 499 DCHECK(!ime_adapter_android_); |
| 500 ime_adapter_android_ = nullptr; | |
| 501 DCHECK(ack_callbacks_.empty()); | 500 DCHECK(ack_callbacks_.empty()); |
| 502 DCHECK(!delegated_frame_host_); | 501 DCHECK(!delegated_frame_host_); |
| 503 } | 502 } |
| 504 | 503 |
| 505 void RenderWidgetHostViewAndroid::Blur() { | 504 void RenderWidgetHostViewAndroid::Blur() { |
| 506 host_->Blur(); | 505 host_->Blur(); |
| 507 if (overscroll_controller_) | 506 if (overscroll_controller_) |
| 508 overscroll_controller_->Disable(); | 507 overscroll_controller_->Disable(); |
| 509 } | 508 } |
| 510 | 509 |
| 510 void RenderWidgetHostViewAndroid::AddDestructionObserver( |
| 511 DestructionObserver* observer) { |
| 512 destruction_observers_.AddObserver(observer); |
| 513 } |
| 514 |
| 515 void RenderWidgetHostViewAndroid::RemoveDestructionObserver( |
| 516 DestructionObserver* observer) { |
| 517 destruction_observers_.RemoveObserver(observer); |
| 518 } |
| 519 |
| 511 bool RenderWidgetHostViewAndroid::OnMessageReceived( | 520 bool RenderWidgetHostViewAndroid::OnMessageReceived( |
| 512 const IPC::Message& message) { | 521 const IPC::Message& message) { |
| 513 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { | 522 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { |
| 514 return SyncCompositorOnMessageReceived(message); | 523 return SyncCompositorOnMessageReceived(message); |
| 515 } | 524 } |
| 516 bool handled = true; | 525 bool handled = true; |
| 517 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) | 526 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) |
| 518 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, | 527 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, |
| 519 OnShowUnhandledTapUIIfNeeded) | 528 OnShowUnhandledTapUIIfNeeded) |
| 520 IPC_MESSAGE_UNHANDLED(handled = false) | 529 IPC_MESSAGE_UNHANDLED(handled = false) |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 host_->ViewDestroyed(); | 1021 host_->ViewDestroyed(); |
| 1013 SetContentViewCore(NULL); | 1022 SetContentViewCore(NULL); |
| 1014 delegated_frame_host_.reset(); | 1023 delegated_frame_host_.reset(); |
| 1015 | 1024 |
| 1016 // The RenderWidgetHost's destruction led here, so don't call it. | 1025 // The RenderWidgetHost's destruction led here, so don't call it. |
| 1017 host_ = NULL; | 1026 host_ = NULL; |
| 1018 | 1027 |
| 1019 if (GetTextInputManager() && GetTextInputManager()->HasObserver(this)) | 1028 if (GetTextInputManager() && GetTextInputManager()->HasObserver(this)) |
| 1020 GetTextInputManager()->RemoveObserver(this); | 1029 GetTextInputManager()->RemoveObserver(this); |
| 1021 | 1030 |
| 1031 for (auto& observer : destruction_observers_) |
| 1032 observer.RenderWidgetHostViewDestroyed(this); |
| 1033 destruction_observers_.Clear(); |
| 1034 |
| 1022 delete this; | 1035 delete this; |
| 1023 } | 1036 } |
| 1024 | 1037 |
| 1025 void RenderWidgetHostViewAndroid::SetTooltipText( | 1038 void RenderWidgetHostViewAndroid::SetTooltipText( |
| 1026 const base::string16& tooltip_text) { | 1039 const base::string16& tooltip_text) { |
| 1027 // Tooltips don't makes sense on Android. | 1040 // Tooltips don't makes sense on Android. |
| 1028 } | 1041 } |
| 1029 | 1042 |
| 1030 void RenderWidgetHostViewAndroid::SetBackgroundColor(SkColor color) { | 1043 void RenderWidgetHostViewAndroid::SetBackgroundColor(SkColor color) { |
| 1031 background_color_ = color; | 1044 background_color_ = color; |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 | 2192 |
| 2180 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2193 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2181 if (!compositor) | 2194 if (!compositor) |
| 2182 return; | 2195 return; |
| 2183 | 2196 |
| 2184 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2197 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2185 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2198 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2186 } | 2199 } |
| 2187 | 2200 |
| 2188 } // namespace content | 2201 } // namespace content |
| OLD | NEW |