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

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

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/logging.h"
6 #include "ui/gfx/screen.h"
7 #include "ui/gfx/screen_type_delegate.h"
8
9 namespace gfx {
10
11 Screen* g_screen_[SCREEN_TYPE_LAST + 1];
oshima 2012/10/10 17:58:23 put these global into anonymous namespace.
scottmg 2012/10/10 19:04:47 Done.
12 ScreenTypeDelegate* g_screen_type_delegate_;
oshima 2012/10/10 17:58:23 = NULL; Strictly speaking, this isn't necessary,
scottmg 2012/10/10 19:04:47 Done.
13
14 Screen::Screen() {
15 }
16
17 Screen::~Screen() {
18 }
19
20 // static
21 Screen* Screen::GetScreenFor(NativeView view) {
22 ScreenType type = SCREEN_TYPE_NATIVE;
23 if (g_screen_type_delegate_)
24 type = g_screen_type_delegate_->GetScreenTypeForNativeView(view);
25 if (type == SCREEN_TYPE_NATIVE)
26 return GetNativeScreen();
27 DCHECK(g_screen_[type]);
28 return g_screen_[type];
29 }
30
31 // static
32 void Screen::SetScreenInstance(ScreenType type, Screen* instance) {
oshima 2012/10/10 17:58:23 DCHECK_LE(type, SCREEN_TYPE_LAST);
scottmg 2012/10/10 19:04:47 Done.
33 g_screen_[type] = instance;
34 }
35
36 // static
37 void Screen::SetScreenTypeDelegate(ScreenTypeDelegate* delegate) {
38 g_screen_type_delegate_ = delegate;
39 }
40
41 // static
42 Screen* Screen::GetNativeScreen() {
43 if (!g_screen_[SCREEN_TYPE_NATIVE])
44 g_screen_[SCREEN_TYPE_NATIVE] = CreateNativeScreen();
45 return g_screen_[SCREEN_TYPE_NATIVE];
46 }
47
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698