Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 23 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 24 #include "chrome/browser/chromeos/login/login_utils.h" | 24 #include "chrome/browser/chromeos/login/login_utils.h" |
| 25 #include "chrome/browser/chromeos/login/user_manager.h" | 25 #include "chrome/browser/chromeos/login/user_manager.h" |
| 26 #include "chrome/browser/chromeos/login/webui_login_display_host.h" | 26 #include "chrome/browser/chromeos/login/webui_login_display_host.h" |
| 27 #include "chrome/browser/chromeos/login/wizard_controller.h" | 27 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 28 #include "chrome/browser/chromeos/mobile_config.h" | 28 #include "chrome/browser/chromeos/mobile_config.h" |
| 29 #include "chrome/browser/chromeos/system/timezone_settings.h" | 29 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 30 #include "chrome/browser/policy/auto_enrollment_client.h" | 30 #include "chrome/browser/policy/auto_enrollment_client.h" |
| 31 #include "chrome/browser/policy/browser_policy_connector.h" | 31 #include "chrome/browser/policy/browser_policy_connector.h" |
| 32 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
| 33 #include "chrome/common/chrome_notification_types.h" | |
| 33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 34 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
| 36 #include "googleurl/src/gurl.h" | 37 #include "googleurl/src/gurl.h" |
| 37 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" | 38 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" |
| 38 #include "ui/base/resource/resource_bundle.h" | 39 #include "ui/base/resource/resource_bundle.h" |
| 39 #include "ui/gfx/rect.h" | 40 #include "ui/gfx/rect.h" |
| 40 #include "unicode/timezone.h" | 41 #include "unicode/timezone.h" |
| 41 | 42 |
| 42 #if defined(TOOLKIT_USES_GTK) | 43 #if defined(TOOLKIT_USES_GTK) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 | 132 |
| 132 BaseLoginDisplayHost::BaseLoginDisplayHost(const gfx::Rect& background_bounds) | 133 BaseLoginDisplayHost::BaseLoginDisplayHost(const gfx::Rect& background_bounds) |
| 133 : background_bounds_(background_bounds) { | 134 : background_bounds_(background_bounds) { |
| 134 // We need to listen to APP_EXITING but not APP_TERMINATING because | 135 // We need to listen to APP_EXITING but not APP_TERMINATING because |
| 135 // APP_TERMINATING will never be fired as long as this keeps ref-count. | 136 // APP_TERMINATING will never be fired as long as this keeps ref-count. |
| 136 // APP_EXITING is safe here because there will be no browser instance that | 137 // APP_EXITING is safe here because there will be no browser instance that |
| 137 // will block the shutdown. | 138 // will block the shutdown. |
| 138 registrar_.Add(this, | 139 registrar_.Add(this, |
| 139 content::NOTIFICATION_APP_EXITING, | 140 content::NOTIFICATION_APP_EXITING, |
| 140 content::NotificationService::AllSources()); | 141 content::NotificationService::AllSources()); |
| 142 | |
| 143 // NOTIFICATION_BROWSER_OPENED is issued after browser is creaetd, but | |
|
Nikita (slow)
2012/01/31 15:26:24
nit: created
oshima
2012/01/31 17:47:51
Done.
| |
| 144 // not shown yet. Lock window has to be closed at this point so that | |
| 145 // a browser window exists and the window can acquire input focus. | |
| 146 registrar_.Add(this, | |
| 147 chrome::NOTIFICATION_BROWSER_OPENED, | |
| 148 content::NotificationService::AllSources()); | |
| 141 DCHECK(default_host_ == NULL); | 149 DCHECK(default_host_ == NULL); |
| 142 default_host_ = this; | 150 default_host_ = this; |
| 143 | 151 |
| 144 // Add a reference count so the message loop won't exit when other | 152 // Add a reference count so the message loop won't exit when other |
| 145 // message loop clients (e.g. menus) do. | 153 // message loop clients (e.g. menus) do. |
| 146 g_browser_process->AddRefModule(); | 154 g_browser_process->AddRefModule(); |
| 147 } | 155 } |
| 148 | 156 |
| 149 BaseLoginDisplayHost::~BaseLoginDisplayHost() { | 157 BaseLoginDisplayHost::~BaseLoginDisplayHost() { |
| 150 // A browser should already exist when destructor is called since | 158 // A browser should already exist when destructor is called since |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 base::Unretained(this))); | 265 base::Unretained(this))); |
| 258 } | 266 } |
| 259 | 267 |
| 260 //////////////////////////////////////////////////////////////////////////////// | 268 //////////////////////////////////////////////////////////////////////////////// |
| 261 // BaseLoginDisplayHost, content:NotificationObserver implementation: | 269 // BaseLoginDisplayHost, content:NotificationObserver implementation: |
| 262 | 270 |
| 263 void BaseLoginDisplayHost::Observe( | 271 void BaseLoginDisplayHost::Observe( |
| 264 int type, | 272 int type, |
| 265 const content::NotificationSource& source, | 273 const content::NotificationSource& source, |
| 266 const content::NotificationDetails& details) { | 274 const content::NotificationDetails& details) { |
| 267 CHECK(type == content::NOTIFICATION_APP_EXITING); | 275 registrar_.RemoveAll(); |
| 268 ShutdownDisplayHost(true); | 276 switch (type) { |
| 277 case content::NOTIFICATION_APP_EXITING: | |
| 278 ShutdownDisplayHost(true); | |
| 279 break; | |
| 280 case chrome::NOTIFICATION_BROWSER_OPENED: | |
| 281 OnBrowserCreated(); | |
| 282 break; | |
| 283 default: | |
| 284 LOG(FATAL) << "Unknown notification type:" << type; | |
| 285 } | |
| 269 } | 286 } |
| 270 | 287 |
| 271 void BaseLoginDisplayHost::ShutdownDisplayHost(bool post_quit_task) { | 288 void BaseLoginDisplayHost::ShutdownDisplayHost(bool post_quit_task) { |
| 272 registrar_.RemoveAll(); | 289 registrar_.RemoveAll(); |
| 273 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 290 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 274 if (post_quit_task) | 291 if (post_quit_task) |
| 275 MessageLoop::current()->Quit(); | 292 MessageLoop::current()->Quit(); |
| 276 } | 293 } |
| 277 | 294 |
| 278 void BaseLoginDisplayHost::StartAnimation() { | 295 void BaseLoginDisplayHost::StartAnimation() { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 // user has changed to during OOBE. | 549 // user has changed to during OOBE. |
| 533 if (!timezone_name.empty()) { | 550 if (!timezone_name.empty()) { |
| 534 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 551 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
| 535 icu::UnicodeString::fromUTF8(timezone_name)); | 552 icu::UnicodeString::fromUTF8(timezone_name)); |
| 536 CHECK(timezone) << "Timezone could not be set for " << timezone_name; | 553 CHECK(timezone) << "Timezone could not be set for " << timezone_name; |
| 537 chromeos::system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); | 554 chromeos::system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); |
| 538 } | 555 } |
| 539 } | 556 } |
| 540 | 557 |
| 541 } // namespace browser | 558 } // namespace browser |
| OLD | NEW |