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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 has_host_context_menu_location_(false), | 381 has_host_context_menu_location_(false), |
382 has_focus_(false), | 382 has_focus_(false), |
383 #if defined(OS_MACOSX) | 383 #if defined(OS_MACOSX) |
384 text_input_client_observer_(new TextInputClientObserver(this)), | 384 text_input_client_observer_(new TextInputClientObserver(this)), |
385 #endif | 385 #endif |
386 focused_pepper_plugin_(nullptr) { | 386 focused_pepper_plugin_(nullptr) { |
387 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); | 387 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); |
388 if (!swapped_out) | 388 if (!swapped_out) |
389 RenderProcess::current()->AddRefProcess(); | 389 RenderProcess::current()->AddRefProcess(); |
390 DCHECK(RenderThread::Get()); | 390 DCHECK(RenderThread::Get()); |
391 device_color_profile_.push_back('0'); | |
392 | 391 |
393 // In tests there may not be a RenderThreadImpl. | 392 // In tests there may not be a RenderThreadImpl. |
394 if (RenderThreadImpl::current()) { | 393 if (RenderThreadImpl::current()) { |
395 render_widget_scheduling_state_ = RenderThreadImpl::current() | 394 render_widget_scheduling_state_ = RenderThreadImpl::current() |
396 ->GetRendererScheduler() | 395 ->GetRendererScheduler() |
397 ->NewRenderWidgetSchedulingState(); | 396 ->NewRenderWidgetSchedulingState(); |
398 render_widget_scheduling_state_->SetHidden(is_hidden_); | 397 render_widget_scheduling_state_->SetHidden(is_hidden_); |
399 } | 398 } |
400 } | 399 } |
401 | 400 |
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 return; | 1803 return; |
1805 | 1804 |
1806 device_scale_factor_ = device_scale_factor; | 1805 device_scale_factor_ = device_scale_factor; |
1807 | 1806 |
1808 OnDeviceScaleFactorChanged(); | 1807 OnDeviceScaleFactorChanged(); |
1809 ScheduleComposite(); | 1808 ScheduleComposite(); |
1810 | 1809 |
1811 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_); | 1810 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_); |
1812 } | 1811 } |
1813 | 1812 |
1814 bool RenderWidget::SetDeviceColorProfile( | |
1815 const std::vector<char>& color_profile) { | |
1816 if (device_color_profile_ == color_profile) | |
1817 return false; | |
1818 | |
1819 device_color_profile_ = color_profile; | |
1820 | |
1821 if (owner_delegate_) | |
1822 owner_delegate_->RenderWidgetDidSetColorProfile(color_profile); | |
1823 | |
1824 return true; | |
1825 } | |
1826 | |
1827 void RenderWidget::OnOrientationChange() { | 1813 void RenderWidget::OnOrientationChange() { |
1828 } | 1814 } |
1829 | 1815 |
1830 void RenderWidget::SetHidden(bool hidden) { | 1816 void RenderWidget::SetHidden(bool hidden) { |
1831 if (is_hidden_ == hidden) | 1817 if (is_hidden_ == hidden) |
1832 return; | 1818 return; |
1833 | 1819 |
1834 // The status has changed. Tell the RenderThread about it and ensure | 1820 // The status has changed. Tell the RenderThread about it and ensure |
1835 // throttled acks are released in case frame production ceases. | 1821 // throttled acks are released in case frame production ceases. |
1836 is_hidden_ = hidden; | 1822 is_hidden_ = hidden; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 GetWebWidget()->selectionTextDirection(params.focus_dir, | 1937 GetWebWidget()->selectionTextDirection(params.focus_dir, |
1952 params.anchor_dir); | 1938 params.anchor_dir); |
1953 params.is_anchor_first = GetWebWidget()->isSelectionAnchorFirst(); | 1939 params.is_anchor_first = GetWebWidget()->isSelectionAnchorFirst(); |
1954 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); | 1940 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); |
1955 } | 1941 } |
1956 } | 1942 } |
1957 | 1943 |
1958 UpdateCompositionInfo(false /* not an immediate request */); | 1944 UpdateCompositionInfo(false /* not an immediate request */); |
1959 } | 1945 } |
1960 | 1946 |
1961 void RenderWidget::SetDeviceColorProfileForTesting( | 1947 void RenderWidget::SetDeviceColorSpaceForTesting( |
1962 const std::vector<char>& color_profile) { | 1948 const gfx::ColorSpace& color_space) { |
1963 SetDeviceColorProfile(color_profile); | 1949 if (owner_delegate_) |
| 1950 owner_delegate_->RenderWidgetDidSetColorSpace(color_space); |
1964 } | 1951 } |
1965 | 1952 |
1966 void RenderWidget::DidAutoResize(const gfx::Size& new_size) { | 1953 void RenderWidget::DidAutoResize(const gfx::Size& new_size) { |
1967 WebRect new_size_in_window(0, 0, new_size.width(), new_size.height()); | 1954 WebRect new_size_in_window(0, 0, new_size.width(), new_size.height()); |
1968 convertViewportToWindow(&new_size_in_window); | 1955 convertViewportToWindow(&new_size_in_window); |
1969 if (size_.width() != new_size_in_window.width || | 1956 if (size_.width() != new_size_in_window.width || |
1970 size_.height() != new_size_in_window.height) { | 1957 size_.height() != new_size_in_window.height) { |
1971 size_ = gfx::Size(new_size_in_window.width, new_size_in_window.height); | 1958 size_ = gfx::Size(new_size_in_window.width, new_size_in_window.height); |
1972 | 1959 |
1973 if (resizing_mode_selector_->is_synchronous_mode()) { | 1960 if (resizing_mode_selector_->is_synchronous_mode()) { |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2255 // browser side (https://crbug.com/669219). | 2242 // browser side (https://crbug.com/669219). |
2256 // If there is no WebFrameWidget, then there will be no | 2243 // If there is no WebFrameWidget, then there will be no |
2257 // InputMethodControllers for a WebLocalFrame. | 2244 // InputMethodControllers for a WebLocalFrame. |
2258 return nullptr; | 2245 return nullptr; |
2259 } | 2246 } |
2260 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2247 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
2261 ->getActiveWebInputMethodController(); | 2248 ->getActiveWebInputMethodController(); |
2262 } | 2249 } |
2263 | 2250 |
2264 } // namespace content | 2251 } // namespace content |
OLD | NEW |