| 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 has_host_context_menu_location_(false), | 382 has_host_context_menu_location_(false), |
| 383 has_focus_(false), | 383 has_focus_(false), |
| 384 #if defined(OS_MACOSX) | 384 #if defined(OS_MACOSX) |
| 385 text_input_client_observer_(new TextInputClientObserver(this)), | 385 text_input_client_observer_(new TextInputClientObserver(this)), |
| 386 #endif | 386 #endif |
| 387 focused_pepper_plugin_(nullptr) { | 387 focused_pepper_plugin_(nullptr) { |
| 388 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); | 388 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); |
| 389 if (!swapped_out) | 389 if (!swapped_out) |
| 390 RenderProcess::current()->AddRefProcess(); | 390 RenderProcess::current()->AddRefProcess(); |
| 391 DCHECK(RenderThread::Get()); | 391 DCHECK(RenderThread::Get()); |
| 392 device_color_profile_.push_back('0'); | |
| 393 | 392 |
| 394 // In tests there may not be a RenderThreadImpl. | 393 // In tests there may not be a RenderThreadImpl. |
| 395 if (RenderThreadImpl::current()) { | 394 if (RenderThreadImpl::current()) { |
| 396 render_widget_scheduling_state_ = RenderThreadImpl::current() | 395 render_widget_scheduling_state_ = RenderThreadImpl::current() |
| 397 ->GetRendererScheduler() | 396 ->GetRendererScheduler() |
| 398 ->NewRenderWidgetSchedulingState(); | 397 ->NewRenderWidgetSchedulingState(); |
| 399 render_widget_scheduling_state_->SetHidden(is_hidden_); | 398 render_widget_scheduling_state_->SetHidden(is_hidden_); |
| 400 } | 399 } |
| 401 } | 400 } |
| 402 | 401 |
| (...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 return; | 1819 return; |
| 1821 | 1820 |
| 1822 device_scale_factor_ = device_scale_factor; | 1821 device_scale_factor_ = device_scale_factor; |
| 1823 | 1822 |
| 1824 OnDeviceScaleFactorChanged(); | 1823 OnDeviceScaleFactorChanged(); |
| 1825 ScheduleComposite(); | 1824 ScheduleComposite(); |
| 1826 | 1825 |
| 1827 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_); | 1826 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_); |
| 1828 } | 1827 } |
| 1829 | 1828 |
| 1830 bool RenderWidget::SetDeviceColorProfile( | |
| 1831 const std::vector<char>& color_profile) { | |
| 1832 if (device_color_profile_ == color_profile) | |
| 1833 return false; | |
| 1834 | |
| 1835 device_color_profile_ = color_profile; | |
| 1836 | |
| 1837 if (owner_delegate_) | |
| 1838 owner_delegate_->RenderWidgetDidSetColorProfile(color_profile); | |
| 1839 | |
| 1840 return true; | |
| 1841 } | |
| 1842 | |
| 1843 void RenderWidget::OnOrientationChange() { | 1829 void RenderWidget::OnOrientationChange() { |
| 1844 } | 1830 } |
| 1845 | 1831 |
| 1846 void RenderWidget::SetHidden(bool hidden) { | 1832 void RenderWidget::SetHidden(bool hidden) { |
| 1847 if (is_hidden_ == hidden) | 1833 if (is_hidden_ == hidden) |
| 1848 return; | 1834 return; |
| 1849 | 1835 |
| 1850 // The status has changed. Tell the RenderThread about it and ensure | 1836 // The status has changed. Tell the RenderThread about it and ensure |
| 1851 // throttled acks are released in case frame production ceases. | 1837 // throttled acks are released in case frame production ceases. |
| 1852 is_hidden_ = hidden; | 1838 is_hidden_ = hidden; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 params.is_anchor_first = GetWebWidget()->isSelectionAnchorFirst(); | 1955 params.is_anchor_first = GetWebWidget()->isSelectionAnchorFirst(); |
| 1970 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); | 1956 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); |
| 1971 } | 1957 } |
| 1972 } | 1958 } |
| 1973 | 1959 |
| 1974 UpdateCompositionInfo(false /* not an immediate request */); | 1960 UpdateCompositionInfo(false /* not an immediate request */); |
| 1975 } | 1961 } |
| 1976 | 1962 |
| 1977 void RenderWidget::SetDeviceColorProfileForTesting( | 1963 void RenderWidget::SetDeviceColorProfileForTesting( |
| 1978 const std::vector<char>& color_profile) { | 1964 const std::vector<char>& color_profile) { |
| 1979 SetDeviceColorProfile(color_profile); | 1965 if (owner_delegate_) |
| 1966 owner_delegate_->RenderWidgetDidSetColorProfile(color_profile); |
| 1980 } | 1967 } |
| 1981 | 1968 |
| 1982 void RenderWidget::DidAutoResize(const gfx::Size& new_size) { | 1969 void RenderWidget::DidAutoResize(const gfx::Size& new_size) { |
| 1983 WebRect new_size_in_window(0, 0, new_size.width(), new_size.height()); | 1970 WebRect new_size_in_window(0, 0, new_size.width(), new_size.height()); |
| 1984 convertViewportToWindow(&new_size_in_window); | 1971 convertViewportToWindow(&new_size_in_window); |
| 1985 if (size_.width() != new_size_in_window.width || | 1972 if (size_.width() != new_size_in_window.width || |
| 1986 size_.height() != new_size_in_window.height) { | 1973 size_.height() != new_size_in_window.height) { |
| 1987 size_ = gfx::Size(new_size_in_window.width, new_size_in_window.height); | 1974 size_ = gfx::Size(new_size_in_window.width, new_size_in_window.height); |
| 1988 | 1975 |
| 1989 if (resizing_mode_selector_->is_synchronous_mode()) { | 1976 if (resizing_mode_selector_->is_synchronous_mode()) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2274 // browser side (https://crbug.com/669219). | 2261 // browser side (https://crbug.com/669219). |
| 2275 // If there is no WebFrameWidget, then there will be no | 2262 // If there is no WebFrameWidget, then there will be no |
| 2276 // InputMethodControllers for a WebLocalFrame. | 2263 // InputMethodControllers for a WebLocalFrame. |
| 2277 return nullptr; | 2264 return nullptr; |
| 2278 } | 2265 } |
| 2279 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2266 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2280 ->getActiveWebInputMethodController(); | 2267 ->getActiveWebInputMethodController(); |
| 2281 } | 2268 } |
| 2282 | 2269 |
| 2283 } // namespace content | 2270 } // namespace content |
| OLD | NEW |