Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/delegated_frame_host.h" | 5 #include "content/browser/renderer_host/delegated_frame_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 | 249 |
| 250 void DelegatedFrameHost::WasResized() { | 250 void DelegatedFrameHost::WasResized() { |
| 251 if (client_->DelegatedFrameHostDesiredSizeInDIP() != | 251 if (client_->DelegatedFrameHostDesiredSizeInDIP() != |
| 252 current_frame_size_in_dip_ && | 252 current_frame_size_in_dip_ && |
| 253 !client_->DelegatedFrameHostIsVisible()) | 253 !client_->DelegatedFrameHostIsVisible()) |
| 254 EvictDelegatedFrame(); | 254 EvictDelegatedFrame(); |
| 255 MaybeCreateResizeLock(); | 255 MaybeCreateResizeLock(); |
| 256 UpdateGutters(); | 256 UpdateGutters(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 SkColor DelegatedFrameHost::GetGutterColor() const { | |
| 260 // In fullscreen mode resizing is uncommon, so it makes more sense to | |
| 261 // make the initial switch to fullscreen mode look better by using black as | |
| 262 // the gutter color. | |
| 263 SkColor color = background_color_; | |
| 264 client_->DelegatedFrameHostOverrideGutterColor(&color); | |
|
danakj
2016/04/25 22:17:58
nit: i think maybe passing the color and returning
| |
| 265 return color; | |
| 266 } | |
| 267 | |
| 259 void DelegatedFrameHost::UpdateGutters() { | 268 void DelegatedFrameHost::UpdateGutters() { |
| 260 if (surface_id_.is_null()) { | 269 if (surface_id_.is_null()) { |
| 261 right_gutter_.reset(); | 270 right_gutter_.reset(); |
| 262 bottom_gutter_.reset(); | 271 bottom_gutter_.reset(); |
| 263 return; | 272 return; |
| 264 } | 273 } |
| 274 | |
| 265 if (current_frame_size_in_dip_.width() < | 275 if (current_frame_size_in_dip_.width() < |
| 266 client_->DelegatedFrameHostDesiredSizeInDIP().width()) { | 276 client_->DelegatedFrameHostDesiredSizeInDIP().width()) { |
| 267 right_gutter_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 277 right_gutter_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
| 268 right_gutter_->SetColor(background_color_); | 278 right_gutter_->SetColor(GetGutterColor()); |
| 269 int width = client_->DelegatedFrameHostDesiredSizeInDIP().width() - | 279 int width = client_->DelegatedFrameHostDesiredSizeInDIP().width() - |
| 270 current_frame_size_in_dip_.width(); | 280 current_frame_size_in_dip_.width(); |
| 271 // The right gutter also includes the bottom-right corner, if necessary. | 281 // The right gutter also includes the bottom-right corner, if necessary. |
| 272 int height = client_->DelegatedFrameHostDesiredSizeInDIP().height(); | 282 int height = client_->DelegatedFrameHostDesiredSizeInDIP().height(); |
| 273 right_gutter_->SetBounds( | 283 right_gutter_->SetBounds( |
| 274 gfx::Rect(current_frame_size_in_dip_.width(), 0, width, height)); | 284 gfx::Rect(current_frame_size_in_dip_.width(), 0, width, height)); |
| 275 | 285 |
| 276 client_->DelegatedFrameHostGetLayer()->Add(right_gutter_.get()); | 286 client_->DelegatedFrameHostGetLayer()->Add(right_gutter_.get()); |
| 277 } else { | 287 } else { |
| 278 right_gutter_.reset(); | 288 right_gutter_.reset(); |
| 279 } | 289 } |
| 280 | 290 |
| 281 if (current_frame_size_in_dip_.height() < | 291 if (current_frame_size_in_dip_.height() < |
| 282 client_->DelegatedFrameHostDesiredSizeInDIP().height()) { | 292 client_->DelegatedFrameHostDesiredSizeInDIP().height()) { |
| 283 bottom_gutter_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 293 bottom_gutter_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
| 284 bottom_gutter_->SetColor(background_color_); | 294 bottom_gutter_->SetColor(GetGutterColor()); |
| 285 int width = current_frame_size_in_dip_.width(); | 295 int width = current_frame_size_in_dip_.width(); |
| 286 int height = client_->DelegatedFrameHostDesiredSizeInDIP().height() - | 296 int height = client_->DelegatedFrameHostDesiredSizeInDIP().height() - |
| 287 current_frame_size_in_dip_.height(); | 297 current_frame_size_in_dip_.height(); |
| 288 bottom_gutter_->SetBounds( | 298 bottom_gutter_->SetBounds( |
| 289 gfx::Rect(0, current_frame_size_in_dip_.height(), width, height)); | 299 gfx::Rect(0, current_frame_size_in_dip_.height(), width, height)); |
| 290 client_->DelegatedFrameHostGetLayer()->Add(bottom_gutter_.get()); | 300 client_->DelegatedFrameHostGetLayer()->Add(bottom_gutter_.get()); |
| 291 | 301 |
| 292 } else { | 302 } else { |
| 293 bottom_gutter_.reset(); | 303 bottom_gutter_.reset(); |
| 294 } | 304 } |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 883 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 893 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 884 new_layer->SetShowSurface( | 894 new_layer->SetShowSurface( |
| 885 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 895 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 886 base::Bind(&RequireCallback, base::Unretained(manager)), | 896 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 887 current_surface_size_, current_scale_factor_, | 897 current_surface_size_, current_scale_factor_, |
| 888 current_frame_size_in_dip_); | 898 current_frame_size_in_dip_); |
| 889 } | 899 } |
| 890 } | 900 } |
| 891 | 901 |
| 892 } // namespace content | 902 } // namespace content |
| OLD | NEW |