Chromium Code Reviews| 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 if (ime_adapter_android_) |
| 500 ime_adapter_android_ = nullptr; | 500 ime_adapter_android_ = nullptr; |
|
boliu
2017/04/13 04:29:41
this should be redundant, this should be an DCHECK
Jinsuk Kim
2017/04/13 04:44:05
Done.
| |
| 501 for (auto* observer : destruction_observers_) | |
|
boliu
2017/04/13 04:29:41
this should be called from Destroy, not here, othe
Jinsuk Kim
2017/04/13 04:44:05
Done.
| |
| 502 observer->RenderWidgetHostViewDestroyed(this); | |
| 501 DCHECK(ack_callbacks_.empty()); | 503 DCHECK(ack_callbacks_.empty()); |
| 502 DCHECK(!delegated_frame_host_); | 504 DCHECK(!delegated_frame_host_); |
| 503 } | 505 } |
| 504 | 506 |
| 505 void RenderWidgetHostViewAndroid::Blur() { | 507 void RenderWidgetHostViewAndroid::Blur() { |
| 506 host_->Blur(); | 508 host_->Blur(); |
| 507 if (overscroll_controller_) | 509 if (overscroll_controller_) |
| 508 overscroll_controller_->Disable(); | 510 overscroll_controller_->Disable(); |
| 509 } | 511 } |
| 510 | 512 |
| 513 void RenderWidgetHostViewAndroid::AddDestructionObserver( | |
| 514 DestructionObserver* connector) { | |
| 515 destruction_observers_.push_back(connector); | |
| 516 } | |
| 517 | |
| 518 void RenderWidgetHostViewAndroid::RemoveDestructionObserver( | |
| 519 DestructionObserver* connector) { | |
| 520 auto it = std::find(destruction_observers_.begin(), | |
| 521 destruction_observers_.end(), connector); | |
| 522 DCHECK(it != destruction_observers_.end()); | |
| 523 destruction_observers_.erase(it); | |
| 524 } | |
| 525 | |
| 511 bool RenderWidgetHostViewAndroid::OnMessageReceived( | 526 bool RenderWidgetHostViewAndroid::OnMessageReceived( |
| 512 const IPC::Message& message) { | 527 const IPC::Message& message) { |
| 513 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { | 528 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { |
| 514 return SyncCompositorOnMessageReceived(message); | 529 return SyncCompositorOnMessageReceived(message); |
| 515 } | 530 } |
| 516 bool handled = true; | 531 bool handled = true; |
| 517 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) | 532 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) |
| 518 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, | 533 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, |
| 519 OnShowUnhandledTapUIIfNeeded) | 534 OnShowUnhandledTapUIIfNeeded) |
| 520 IPC_MESSAGE_UNHANDLED(handled = false) | 535 IPC_MESSAGE_UNHANDLED(handled = false) |
| (...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2179 | 2194 |
| 2180 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2195 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2181 if (!compositor) | 2196 if (!compositor) |
| 2182 return; | 2197 return; |
| 2183 | 2198 |
| 2184 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2199 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2185 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2200 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2186 } | 2201 } |
| 2187 | 2202 |
| 2188 } // namespace content | 2203 } // namespace content |
| OLD | NEW |