OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/wizard_controller.h" | 5 #include "chrome/browser/chromeos/login/wizard_controller.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 39 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
40 #include "chrome/browser/chromeos/login/update_screen.h" | 40 #include "chrome/browser/chromeos/login/update_screen.h" |
41 #include "chrome/browser/chromeos/login/user_image_screen.h" | 41 #include "chrome/browser/chromeos/login/user_image_screen.h" |
42 #include "chrome/browser/chromeos/login/user_manager.h" | 42 #include "chrome/browser/chromeos/login/user_manager.h" |
43 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 43 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
44 #include "chrome/browser/chromeos/wm_ipc.h" | 44 #include "chrome/browser/chromeos/wm_ipc.h" |
45 #include "chrome/browser/prefs/pref_service.h" | 45 #include "chrome/browser/prefs/pref_service.h" |
46 #include "chrome/browser/profiles/profile_manager.h" | 46 #include "chrome/browser/profiles/profile_manager.h" |
47 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
48 #include "chrome/common/notification_service.h" | 48 #include "chrome/common/notification_service.h" |
| 49 #include "chrome/common/notification_type.h" |
49 #include "chrome/common/pref_names.h" | 50 #include "chrome/common/pref_names.h" |
50 #include "cros/chromeos_wm_ipc_enums.h" | 51 #include "cros/chromeos_wm_ipc_enums.h" |
51 #include "unicode/timezone.h" | 52 #include "unicode/timezone.h" |
52 #include "views/accelerator.h" | 53 #include "views/accelerator.h" |
53 #include "views/painter.h" | 54 #include "views/painter.h" |
54 #include "views/view.h" | 55 #include "views/view.h" |
55 #include "views/widget/widget_gtk.h" | 56 #include "views/widget/widget_gtk.h" |
56 | 57 |
57 namespace { | 58 namespace { |
58 | 59 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 #if defined(OFFICIAL_BUILD) | 260 #if defined(OFFICIAL_BUILD) |
260 is_official_build_(true), | 261 is_official_build_(true), |
261 #else | 262 #else |
262 is_official_build_(false), | 263 is_official_build_(false), |
263 #endif | 264 #endif |
264 is_out_of_box_(false), | 265 is_out_of_box_(false), |
265 is_test_mode_(false), | 266 is_test_mode_(false), |
266 observer_(NULL) { | 267 observer_(NULL) { |
267 DCHECK(default_controller_ == NULL); | 268 DCHECK(default_controller_ == NULL); |
268 default_controller_ = this; | 269 default_controller_ = this; |
| 270 registrar_.Add( |
| 271 this, |
| 272 NotificationType::APP_TERMINATING, |
| 273 NotificationService::AllSources()); |
269 } | 274 } |
270 | 275 |
271 WizardController::~WizardController() { | 276 WizardController::~WizardController() { |
272 // Close ends up deleting the widget. | 277 // Close ends up deleting the widget. |
273 if (background_widget_) | 278 if (background_widget_) |
274 background_widget_->Close(); | 279 background_widget_->Close(); |
275 | 280 |
276 if (widget_) | 281 if (widget_) |
277 widget_->Close(); | 282 widget_->Close(); |
278 | 283 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 return customization_.get(); | 511 return customization_.get(); |
507 } | 512 } |
508 | 513 |
509 void WizardController::SkipRegistration() { | 514 void WizardController::SkipRegistration() { |
510 if (current_screen_ == GetRegistrationScreen()) | 515 if (current_screen_ == GetRegistrationScreen()) |
511 OnRegistrationSkipped(); | 516 OnRegistrationSkipped(); |
512 else | 517 else |
513 LOG(ERROR) << "Registration screen is not active."; | 518 LOG(ERROR) << "Registration screen is not active."; |
514 } | 519 } |
515 | 520 |
| 521 void WizardController::Observe(NotificationType type, |
| 522 const NotificationSource& source, |
| 523 const NotificationDetails& details) { |
| 524 CHECK(type == NotificationType::APP_TERMINATING); |
| 525 |
| 526 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 527 MessageLoop::current()->Quit(); |
| 528 registrar_.Remove(this, |
| 529 NotificationType::APP_TERMINATING, |
| 530 NotificationService::AllSources()); |
| 531 } |
| 532 |
516 // static | 533 // static |
517 void WizardController::RegisterPrefs(PrefService* local_state) { | 534 void WizardController::RegisterPrefs(PrefService* local_state) { |
518 local_state->RegisterBooleanPref(kOobeComplete, false); | 535 local_state->RegisterBooleanPref(kOobeComplete, false); |
519 local_state->RegisterBooleanPref(kEulaAccepted, false); | 536 local_state->RegisterBooleanPref(kEulaAccepted, false); |
520 // Check if the pref is already registered in case | 537 // Check if the pref is already registered in case |
521 // Preferences::RegisterUserPrefs runs before this code in the future. | 538 // Preferences::RegisterUserPrefs runs before this code in the future. |
522 if (local_state->FindPreference(prefs::kAccessibilityEnabled) == NULL) { | 539 if (local_state->FindPreference(prefs::kAccessibilityEnabled) == NULL) { |
523 local_state->RegisterBooleanPref(prefs::kAccessibilityEnabled, false); | 540 local_state->RegisterBooleanPref(prefs::kAccessibilityEnabled, false); |
524 } | 541 } |
525 } | 542 } |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 // user has changed to during OOBE. | 1036 // user has changed to during OOBE. |
1020 if (!timezone_name.empty()) { | 1037 if (!timezone_name.empty()) { |
1021 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 1038 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
1022 icu::UnicodeString::fromUTF8(timezone_name)); | 1039 icu::UnicodeString::fromUTF8(timezone_name)); |
1023 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); | 1040 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); |
1024 } | 1041 } |
1025 } | 1042 } |
1026 } | 1043 } |
1027 | 1044 |
1028 } // namespace browser | 1045 } // namespace browser |
OLD | NEW |