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

Side by Side Diff: ui/aura/env.cc

Issue 23882007: Explicit initialization of aura::Env for browser shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unnecessary call Created 7 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 | Annotate | Revision Log
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 "ui/aura/env.h" 5 #include "ui/aura/env.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "ui/aura/env_observer.h" 8 #include "ui/aura/env_observer.h"
9 #include "ui/aura/root_window_host.h" 9 #include "ui/aura/root_window_host.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 21 matching lines...) Expand all
32 #if defined(USE_X11) 32 #if defined(USE_X11)
33 base::MessagePumpAuraX11::Current()->RemoveObserver( 33 base::MessagePumpAuraX11::Current()->RemoveObserver(
34 &device_list_updater_aurax11_); 34 &device_list_updater_aurax11_);
35 #endif 35 #endif
36 36
37 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWillDestroyEnv()); 37 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWillDestroyEnv());
38 38
39 ui::Compositor::Terminate(); 39 ui::Compositor::Terminate();
40 } 40 }
41 41
42 //static
43 void Env::CreateInstance() {
44 if (!instance_) {
dnicoara 2013/09/10 19:15:00 I would have liked to have this as a check and onl
45 instance_ = new Env;
46 instance_->Init();
47 }
48 }
49
42 // static 50 // static
43 Env* Env::GetInstance() { 51 Env* Env::GetInstance() {
44 if (!instance_) { 52 DCHECK(instance_) << "Env::CreateInstance must be called before getting "
45 instance_ = new Env; 53 "the instance of Env.";
46 instance_->Init();
47 }
48 return instance_; 54 return instance_;
49 } 55 }
50 56
51 // static 57 // static
52 void Env::DeleteInstance() { 58 void Env::DeleteInstance() {
53 delete instance_; 59 delete instance_;
54 instance_ = NULL; 60 instance_ = NULL;
55 } 61 }
56 62
57 void Env::AddObserver(EnvObserver* observer) { 63 void Env::AddObserver(EnvObserver* observer) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 114
109 bool Env::CanAcceptEvent(const ui::Event& event) { 115 bool Env::CanAcceptEvent(const ui::Event& event) {
110 return true; 116 return true;
111 } 117 }
112 118
113 ui::EventTarget* Env::GetParentTarget() { 119 ui::EventTarget* Env::GetParentTarget() {
114 return NULL; 120 return NULL;
115 } 121 }
116 122
117 } // namespace aura 123 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698