| 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_base.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/browser/accessibility/browser_accessibility_manager.h" | 9 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 10 #include "content/browser/gpu/gpu_data_manager_impl.h" | 10 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // host pointer, as in RenderWidgetHostViewGuest. There is no harm in calling | 57 // host pointer, as in RenderWidgetHostViewGuest. There is no harm in calling |
| 58 // NotifyObserversAboutShutdown() twice, as the observers are required to | 58 // NotifyObserversAboutShutdown() twice, as the observers are required to |
| 59 // de-register on the first call, and so the second call does nothing. | 59 // de-register on the first call, and so the second call does nothing. |
| 60 NotifyObserversAboutShutdown(); | 60 NotifyObserversAboutShutdown(); |
| 61 // If we have a live reference to |text_input_manager_|, we should unregister | 61 // If we have a live reference to |text_input_manager_|, we should unregister |
| 62 // so that the |text_input_manager_| will free its state. | 62 // so that the |text_input_manager_| will free its state. |
| 63 if (text_input_manager_) | 63 if (text_input_manager_) |
| 64 text_input_manager_->Unregister(this); | 64 text_input_manager_->Unregister(this); |
| 65 } | 65 } |
| 66 | 66 |
| 67 RenderWidgetHostImpl* RenderWidgetHostViewBase::GetFocusedWidget() const { |
| 68 RenderWidgetHostImpl* host = |
| 69 RenderWidgetHostImpl::From(GetRenderWidgetHost()); |
| 70 return host && host->delegate() |
| 71 ? host->delegate()->GetFocusedRenderWidgetHost(host) |
| 72 : nullptr; |
| 73 } |
| 74 |
| 75 RenderWidgetHost* RenderWidgetHostViewBase::GetRenderWidgetHost() const { |
| 76 return nullptr; |
| 77 } |
| 78 |
| 67 void RenderWidgetHostViewBase::NotifyObserversAboutShutdown() { | 79 void RenderWidgetHostViewBase::NotifyObserversAboutShutdown() { |
| 68 // Note: RenderWidgetHostInputEventRouter is an observer, and uses the | 80 // Note: RenderWidgetHostInputEventRouter is an observer, and uses the |
| 69 // following notification to remove this view from its surface owners map. | 81 // following notification to remove this view from its surface owners map. |
| 70 FOR_EACH_OBSERVER(RenderWidgetHostViewBaseObserver, | 82 FOR_EACH_OBSERVER(RenderWidgetHostViewBaseObserver, |
| 71 observers_, | 83 observers_, |
| 72 OnRenderWidgetHostViewBaseDestroyed(this)); | 84 OnRenderWidgetHostViewBaseDestroyed(this)); |
| 73 // All observers are required to disconnect after they are notified. | 85 // All observers are required to disconnect after they are notified. |
| 74 DCHECK(!observers_.might_have_observers()); | 86 DCHECK(!observers_.might_have_observers()); |
| 75 } | 87 } |
| 76 | 88 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 100 bool RenderWidgetHostViewBase::DoTopControlsShrinkBlinkSize() const { | 112 bool RenderWidgetHostViewBase::DoTopControlsShrinkBlinkSize() const { |
| 101 return false; | 113 return false; |
| 102 } | 114 } |
| 103 | 115 |
| 104 float RenderWidgetHostViewBase::GetTopControlsHeight() const { | 116 float RenderWidgetHostViewBase::GetTopControlsHeight() const { |
| 105 return 0.f; | 117 return 0.f; |
| 106 } | 118 } |
| 107 | 119 |
| 108 void RenderWidgetHostViewBase::SelectionBoundsChanged( | 120 void RenderWidgetHostViewBase::SelectionBoundsChanged( |
| 109 const ViewHostMsg_SelectionBounds_Params& params) { | 121 const ViewHostMsg_SelectionBounds_Params& params) { |
| 122 #if !defined(OS_ANDROID) |
| 110 if (GetTextInputManager()) | 123 if (GetTextInputManager()) |
| 111 GetTextInputManager()->SelectionBoundsChanged(this, params); | 124 GetTextInputManager()->SelectionBoundsChanged(this, params); |
| 125 #else |
| 126 NOTREACHED() << "Selection bounds should be routed through the compositor."; |
| 127 #endif |
| 112 } | 128 } |
| 113 | 129 |
| 114 void RenderWidgetHostViewBase::SelectionChanged(const base::string16& text, | 130 void RenderWidgetHostViewBase::SelectionChanged(const base::string16& text, |
| 115 size_t offset, | 131 size_t offset, |
| 116 const gfx::Range& range) { | 132 const gfx::Range& range) { |
| 117 // TODO(ekaramad): Use TextInputManager code paths for IME on other platforms. | 133 // TODO(ekaramad): Use TextInputManager code paths for IME on other platforms. |
| 118 // Also, remove the following local variables when that happens | 134 // Also, remove the following local variables when that happens |
| 119 // (https://crbug.com/578168 and https://crbug.com/602427). | 135 // (https://crbug.com/578168 and https://crbug.com/602427). |
| 120 #if defined(USE_AURA) | 136 #if defined(USE_AURA) |
| 121 if (GetTextInputManager()) | 137 if (GetTextInputManager()) |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 509 |
| 494 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { | 510 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { |
| 495 return false; | 511 return false; |
| 496 } | 512 } |
| 497 | 513 |
| 498 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { | 514 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { |
| 499 return cc::SurfaceId(); | 515 return cc::SurfaceId(); |
| 500 } | 516 } |
| 501 | 517 |
| 502 } // namespace content | 518 } // namespace content |
| OLD | NEW |