OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/login/base_login_display_host.h" | 5 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // BaseLoginDisplayHost -------------------------------------------------------- | 83 // BaseLoginDisplayHost -------------------------------------------------------- |
84 | 84 |
85 BaseLoginDisplayHost::BaseLoginDisplayHost(const gfx::Rect& background_bounds) | 85 BaseLoginDisplayHost::BaseLoginDisplayHost(const gfx::Rect& background_bounds) |
86 : background_bounds_(background_bounds) { | 86 : background_bounds_(background_bounds) { |
87 registrar_.Add( | 87 registrar_.Add( |
88 this, | 88 this, |
89 NotificationType::APP_TERMINATING, | 89 NotificationType::APP_TERMINATING, |
90 NotificationService::AllSources()); | 90 NotificationService::AllSources()); |
91 DCHECK(default_host_ == NULL); | 91 DCHECK(default_host_ == NULL); |
92 default_host_ = this; | 92 default_host_ = this; |
| 93 |
| 94 // Add a reference count so the message loop won't exit when other |
| 95 // message loop clients (e.g. menus) do. |
| 96 g_browser_process->AddRefModule(); |
93 } | 97 } |
94 | 98 |
95 BaseLoginDisplayHost::~BaseLoginDisplayHost() { | 99 BaseLoginDisplayHost::~BaseLoginDisplayHost() { |
| 100 // A browser should already exist when destructor is called since |
| 101 // deletion is scheduled with MessageLoop::DeleteSoon() from |
| 102 // OnSessionStart(), so the browser will already have incremented |
| 103 // the reference count. |
| 104 g_browser_process->ReleaseModule(); |
| 105 |
96 default_host_ = NULL; | 106 default_host_ = NULL; |
97 } | 107 } |
98 | 108 |
99 // LoginDisplayHost implementation --------------------------------------------- | 109 // LoginDisplayHost implementation --------------------------------------------- |
100 | 110 |
101 void BaseLoginDisplayHost::OnSessionStart() { | 111 void BaseLoginDisplayHost::OnSessionStart() { |
102 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 112 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
103 } | 113 } |
104 | 114 |
105 void BaseLoginDisplayHost::StartWizard( | 115 void BaseLoginDisplayHost::StartWizard( |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // user has changed to during OOBE. | 285 // user has changed to during OOBE. |
276 if (!timezone_name.empty()) { | 286 if (!timezone_name.empty()) { |
277 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 287 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
278 icu::UnicodeString::fromUTF8(timezone_name)); | 288 icu::UnicodeString::fromUTF8(timezone_name)); |
279 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); | 289 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); |
280 } | 290 } |
281 } | 291 } |
282 } | 292 } |
283 | 293 |
284 } // namespace browser | 294 } // namespace browser |
OLD | NEW |