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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_base.cc

Issue 2317563004: Change blink::WebScreenInfo to content::ScreenInfo (Closed)
Patch Set: Fix Windows compile Created 4 years, 3 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/browser/renderer_host/render_widget_host_view_base.h" 5 #include "content/browser/renderer_host/render_widget_host_view_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/accessibility/browser_accessibility_manager.h" 9 #include "content/browser/accessibility/browser_accessibility_manager.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 10 #include "content/browser/gpu/gpu_data_manager_impl.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 gfx::Size RenderWidgetHostViewBase::GetVisibleViewportSize() const { 350 gfx::Size RenderWidgetHostViewBase::GetVisibleViewportSize() const {
351 return GetViewBounds().size(); 351 return GetViewBounds().size();
352 } 352 }
353 353
354 void RenderWidgetHostViewBase::SetInsets(const gfx::Insets& insets) { 354 void RenderWidgetHostViewBase::SetInsets(const gfx::Insets& insets) {
355 NOTIMPLEMENTED(); 355 NOTIMPLEMENTED();
356 } 356 }
357 357
358 // static 358 // static
359 blink::WebScreenOrientationType 359 ScreenOrientationValues RenderWidgetHostViewBase::GetOrientationTypeForMobile(
360 RenderWidgetHostViewBase::GetOrientationTypeForMobile(
361 const display::Display& display) { 360 const display::Display& display) {
362 int angle = display.RotationAsDegree(); 361 int angle = display.RotationAsDegree();
363 const gfx::Rect& bounds = display.bounds(); 362 const gfx::Rect& bounds = display.bounds();
364 363
365 // Whether the device's natural orientation is portrait. 364 // Whether the device's natural orientation is portrait.
366 bool natural_portrait = false; 365 bool natural_portrait = false;
367 if (angle == 0 || angle == 180) // The device is in its natural orientation. 366 if (angle == 0 || angle == 180) // The device is in its natural orientation.
368 natural_portrait = bounds.height() >= bounds.width(); 367 natural_portrait = bounds.height() >= bounds.width();
369 else 368 else
370 natural_portrait = bounds.height() <= bounds.width(); 369 natural_portrait = bounds.height() <= bounds.width();
371 370
372 switch (angle) { 371 switch (angle) {
373 case 0: 372 case 0:
374 return natural_portrait ? blink::WebScreenOrientationPortraitPrimary 373 return natural_portrait ? SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY
375 : blink::WebScreenOrientationLandscapePrimary; 374 : SCREEN_ORIENTATION_VALUES_LANDSCAPE_PRIMARY;
376 case 90: 375 case 90:
377 return natural_portrait ? blink::WebScreenOrientationLandscapePrimary 376 return natural_portrait ? SCREEN_ORIENTATION_VALUES_LANDSCAPE_PRIMARY
378 : blink::WebScreenOrientationPortraitSecondary; 377 : SCREEN_ORIENTATION_VALUES_PORTRAIT_SECONDARY;
379 case 180: 378 case 180:
380 return natural_portrait ? blink::WebScreenOrientationPortraitSecondary 379 return natural_portrait ? SCREEN_ORIENTATION_VALUES_PORTRAIT_SECONDARY
381 : blink::WebScreenOrientationLandscapeSecondary; 380 : SCREEN_ORIENTATION_VALUES_LANDSCAPE_SECONDARY;
382 case 270: 381 case 270:
383 return natural_portrait ? blink::WebScreenOrientationLandscapeSecondary 382 return natural_portrait ? SCREEN_ORIENTATION_VALUES_LANDSCAPE_SECONDARY
384 : blink::WebScreenOrientationPortraitPrimary; 383 : SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY;
385 default: 384 default:
386 NOTREACHED(); 385 NOTREACHED();
387 return blink::WebScreenOrientationPortraitPrimary; 386 return SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY;
388 } 387 }
389 } 388 }
390 389
391 // static 390 // static
392 blink::WebScreenOrientationType 391 ScreenOrientationValues RenderWidgetHostViewBase::GetOrientationTypeForDesktop(
393 RenderWidgetHostViewBase::GetOrientationTypeForDesktop(
394 const display::Display& display) { 392 const display::Display& display) {
395 static int primary_landscape_angle = -1; 393 static int primary_landscape_angle = -1;
396 static int primary_portrait_angle = -1; 394 static int primary_portrait_angle = -1;
397 395
398 int angle = display.RotationAsDegree(); 396 int angle = display.RotationAsDegree();
399 const gfx::Rect& bounds = display.bounds(); 397 const gfx::Rect& bounds = display.bounds();
400 bool is_portrait = bounds.height() >= bounds.width(); 398 bool is_portrait = bounds.height() >= bounds.width();
401 399
402 if (is_portrait && primary_portrait_angle == -1) 400 if (is_portrait && primary_portrait_angle == -1)
403 primary_portrait_angle = angle; 401 primary_portrait_angle = angle;
404 402
405 if (!is_portrait && primary_landscape_angle == -1) 403 if (!is_portrait && primary_landscape_angle == -1)
406 primary_landscape_angle = angle; 404 primary_landscape_angle = angle;
407 405
408 if (is_portrait) { 406 if (is_portrait) {
409 return primary_portrait_angle == angle 407 return primary_portrait_angle == angle
410 ? blink::WebScreenOrientationPortraitPrimary 408 ? SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY
411 : blink::WebScreenOrientationPortraitSecondary; 409 : SCREEN_ORIENTATION_VALUES_PORTRAIT_SECONDARY;
412 } 410 }
413 411
414 return primary_landscape_angle == angle 412 return primary_landscape_angle == angle
415 ? blink::WebScreenOrientationLandscapePrimary 413 ? SCREEN_ORIENTATION_VALUES_LANDSCAPE_PRIMARY
416 : blink::WebScreenOrientationLandscapeSecondary; 414 : SCREEN_ORIENTATION_VALUES_LANDSCAPE_SECONDARY;
417 } 415 }
418 416
419 void RenderWidgetHostViewBase::OnDidNavigateMainFrameToNewPage() { 417 void RenderWidgetHostViewBase::OnDidNavigateMainFrameToNewPage() {
420 } 418 }
421 419
422 uint32_t RenderWidgetHostViewBase::GetSurfaceClientId() { 420 uint32_t RenderWidgetHostViewBase::GetSurfaceClientId() {
423 return 0; 421 return 0;
424 } 422 }
425 423
426 uint32_t RenderWidgetHostViewBase::SurfaceClientIdAtPoint( 424 uint32_t RenderWidgetHostViewBase::SurfaceClientIdAtPoint(
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 512
515 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { 513 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const {
516 return false; 514 return false;
517 } 515 }
518 516
519 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { 517 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const {
520 return cc::SurfaceId(); 518 return cc::SurfaceId();
521 } 519 }
522 520
523 } // namespace content 521 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698