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

Side by Side Diff: ui/gfx/screen.cc

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: and another rebase Created 4 years, 10 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
« no previous file with comments | « ui/gfx/screen.h ('k') | ui/gfx/screen_type_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "ui/gfx/screen.h" 6 #include "ui/gfx/screen.h"
7 #include "ui/gfx/screen_type_delegate.h"
8 7
9 namespace gfx { 8 namespace gfx {
10 9
11 namespace { 10 namespace {
12 11
13 Screen* g_screen_[SCREEN_TYPE_LAST + 1]; 12 Screen* g_screen;
14 ScreenTypeDelegate* g_screen_type_delegate_ = NULL;
15 13
16 } // namespace 14 } // namespace
17 15
18 Screen::Screen() { 16 Screen::Screen() {
19 } 17 }
20 18
21 Screen::~Screen() { 19 Screen::~Screen() {
22 } 20 }
23 21
24 // static 22 // static
25 Screen* Screen::GetScreenFor(NativeView view) { 23 Screen* Screen::GetScreen() {
26 ScreenType type = SCREEN_TYPE_NATIVE; 24 #if defined(OS_MACOSX) || defined(OS_ANDROID)
27 if (g_screen_type_delegate_) 25 // TODO(scottmg): https://crbug.com/558054
28 type = g_screen_type_delegate_->GetScreenTypeForNativeView(view); 26 if (!g_screen)
29 if (type == SCREEN_TYPE_NATIVE) 27 g_screen = CreateNativeScreen();
30 return GetNativeScreen(); 28 #endif
31 DCHECK(g_screen_[type]); 29 return g_screen;
32 return g_screen_[type];
33 } 30 }
34 31
35 // static 32 // static
36 void Screen::SetScreenInstance(ScreenType type, Screen* instance) { 33 void Screen::SetScreenInstance(Screen* instance) {
37 DCHECK_LE(type, SCREEN_TYPE_LAST); 34 g_screen = instance;
38 g_screen_[type] = instance;
39 }
40
41 // static
42 Screen* Screen::GetScreenByType(ScreenType type) {
43 return g_screen_[type];
44 }
45
46 // static
47 void Screen::SetScreenTypeDelegate(ScreenTypeDelegate* delegate) {
48 g_screen_type_delegate_ = delegate;
49 }
50
51 // static
52 Screen* Screen::GetNativeScreen() {
53 if (!g_screen_[SCREEN_TYPE_NATIVE])
54 g_screen_[SCREEN_TYPE_NATIVE] = CreateNativeScreen();
55 return g_screen_[SCREEN_TYPE_NATIVE];
56 } 35 }
57 36
58 } // namespace gfx 37 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/screen.h ('k') | ui/gfx/screen_type_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698