Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 964403003: Make it possible to set the display mode from Chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after
2991 webview()->disableAutoResizeMode(); 2991 webview()->disableAutoResizeMode();
2992 2992
2993 if (!new_size.IsEmpty()) { 2993 if (!new_size.IsEmpty()) {
2994 Resize(new_size, 2994 Resize(new_size,
2995 physical_backing_size_, 2995 physical_backing_size_,
2996 top_controls_shrink_blink_size_, 2996 top_controls_shrink_blink_size_,
2997 top_controls_height_, 2997 top_controls_height_,
2998 visible_viewport_size_, 2998 visible_viewport_size_,
2999 resizer_rect_, 2999 resizer_rect_,
3000 is_fullscreen_, 3000 is_fullscreen_,
3001 display_mode_,
3001 NO_RESIZE_ACK); 3002 NO_RESIZE_ACK);
3002 } 3003 }
3003 } 3004 }
3004 3005
3005 void RenderViewImpl::OnEnablePreferredSizeChangedMode() { 3006 void RenderViewImpl::OnEnablePreferredSizeChangedMode() {
3006 if (send_preferred_size_changes_) 3007 if (send_preferred_size_changes_)
3007 return; 3008 return;
3008 send_preferred_size_changes_ = true; 3009 send_preferred_size_changes_ = true;
3009 3010
3010 // Start off with an initial preferred size notification (in case 3011 // Start off with an initial preferred size notification (in case
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 3176
3176 void RenderViewImpl::OnResize(const ViewMsg_Resize_Params& params) { 3177 void RenderViewImpl::OnResize(const ViewMsg_Resize_Params& params) {
3177 TRACE_EVENT0("renderer", "RenderViewImpl::OnResize"); 3178 TRACE_EVENT0("renderer", "RenderViewImpl::OnResize");
3178 if (webview()) { 3179 if (webview()) {
3179 webview()->hidePopups(); 3180 webview()->hidePopups();
3180 if (send_preferred_size_changes_) { 3181 if (send_preferred_size_changes_) {
3181 webview()->mainFrame()->setCanHaveScrollbars( 3182 webview()->mainFrame()->setCanHaveScrollbars(
3182 ShouldDisplayScrollbars(params.new_size.width(), 3183 ShouldDisplayScrollbars(params.new_size.width(),
3183 params.new_size.height())); 3184 params.new_size.height()));
3184 } 3185 }
3186 // TODO: Shouldn't it be checked inside Blink instead?
kenneth.christiansen 2015/03/06 12:21:29 I guess if this saves IPC then it is better
3187 if (display_mode_ != params.display_mode)
3188 webview()->setDisplayMode(display_mode_);
3185 } 3189 }
3186 3190
3187 gfx::Size old_visible_viewport_size = visible_viewport_size_; 3191 gfx::Size old_visible_viewport_size = visible_viewport_size_;
3188 3192
3189 RenderWidget::OnResize(params); 3193 RenderWidget::OnResize(params);
3190 3194
3191 if (old_visible_viewport_size != visible_viewport_size_) 3195 if (old_visible_viewport_size != visible_viewport_size_)
3192 has_scrolled_focused_editable_node_into_rect_ = false; 3196 has_scrolled_focused_editable_node_into_rect_ = false;
3193 } 3197 }
3194 3198
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
3983 ViewMsg_Resize_Params params; 3987 ViewMsg_Resize_Params params;
3984 params.screen_info = screen_info_; 3988 params.screen_info = screen_info_;
3985 params.screen_info.deviceScaleFactor = factor; 3989 params.screen_info.deviceScaleFactor = factor;
3986 params.new_size = size(); 3990 params.new_size = size();
3987 params.visible_viewport_size = visible_viewport_size_; 3991 params.visible_viewport_size = visible_viewport_size_;
3988 params.physical_backing_size = 3992 params.physical_backing_size =
3989 gfx::ToCeiledSize(gfx::ScaleSize(size(), factor)); 3993 gfx::ToCeiledSize(gfx::ScaleSize(size(), factor));
3990 params.top_controls_shrink_blink_size = false; 3994 params.top_controls_shrink_blink_size = false;
3991 params.top_controls_height = 0.f; 3995 params.top_controls_height = 0.f;
3992 params.resizer_rect = WebRect(); 3996 params.resizer_rect = WebRect();
3993 params.is_fullscreen = is_fullscreen(); 3997 params.is_fullscreen = is_fullscreen_;
3998 params.display_mode = display_mode_;
3994 OnResize(params); 3999 OnResize(params);
3995 } 4000 }
3996 4001
3997 void RenderViewImpl::SetDeviceColorProfileForTesting( 4002 void RenderViewImpl::SetDeviceColorProfileForTesting(
3998 const std::vector<char>& color_profile) { 4003 const std::vector<char>& color_profile) {
3999 SetDeviceColorProfile(color_profile); 4004 SetDeviceColorProfile(color_profile);
4000 } 4005 }
4001 4006
4002 void RenderViewImpl::ForceResizeForTesting(const gfx::Size& new_size) { 4007 void RenderViewImpl::ForceResizeForTesting(const gfx::Size& new_size) {
4003 gfx::Rect new_window_rect(rootWindowRect().x, 4008 gfx::Rect new_window_rect(rootWindowRect().x,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
4057 std::vector<gfx::Size> sizes; 4062 std::vector<gfx::Size> sizes;
4058 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4063 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4059 if (!url.isEmpty()) 4064 if (!url.isEmpty())
4060 urls.push_back( 4065 urls.push_back(
4061 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4066 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4062 } 4067 }
4063 SendUpdateFaviconURL(urls); 4068 SendUpdateFaviconURL(urls);
4064 } 4069 }
4065 4070
4066 } // namespace content 4071 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698