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