summaryrefslogtreecommitdiffstats
path: root/ui/gfx/screen_ios.mm
blob: 42b2edd5ec141b0fa5232aa6438b1e8a01042362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/gfx/screen.h"

#import <UIKit/UIKit.h>

#include "ui/gfx/display.h"

namespace gfx {

// static
gfx::Display Screen::GetPrimaryDisplay() {
  UIScreen* mainScreen = [[UIScreen screens] objectAtIndex:0];
  gfx::Display display(0, gfx::Rect(mainScreen.bounds));
  return display;
}

// static
int Screen::GetNumDisplays() {
#if TARGET_IPHONE_SIMULATOR
  // UIScreen does not reliably return correct results on the simulator.
  return 1;
#else
  return [[UIScreen screens] count];
#endif
}

}  // namespace gfx