Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / login / screens / screen_factory.cc
blob216405b56af90e8c2d2803a80201db8eedb9f92c
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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/login/screens/screen_factory.h"
7 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h"
8 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_screen.h"
9 #include "chrome/browser/chromeos/login/screens/base_screen.h"
10 #include "chrome/browser/chromeos/login/screens/error_screen.h"
11 #include "chrome/browser/chromeos/login/screens/eula_screen.h"
12 #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h"
13 #include "chrome/browser/chromeos/login/screens/network_screen.h"
14 #include "chrome/browser/chromeos/login/screens/reset_screen.h"
15 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen.h"
16 #include "chrome/browser/chromeos/login/screens/update_screen.h"
17 #include "chrome/browser/chromeos/login/screens/user_image_screen.h"
18 #include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h"
20 namespace chromeos {
22 // static
23 const char ScreenFactory::kEnrollmentScreenId[] = "enroll";
24 const char ScreenFactory::kErrorScreenId[] = "error-message";
25 const char ScreenFactory::kEulaScreenId[] = "eula";
26 const char ScreenFactory::kKioskAutolaunchScreenId[] = "autolaunch";
27 const char ScreenFactory::kLocallyManagedUserCreationScreenId[] =
28 "locally-managed-user-creation-flow";
29 const char ScreenFactory::kNetworkScreenId[] = "network";
30 const char ScreenFactory::kResetScreenId[] = "reset";
31 const char ScreenFactory::kTermsOfServiceScreenId[] = "tos";
32 const char ScreenFactory::kUpdateScreenId[] = "update";
33 const char ScreenFactory::kUserImageScreenId[] = "image";
34 const char ScreenFactory::kWrongHWIDScreenId[] = "wrong-hwid";
36 const char ScreenFactory::kLoginScreenId[] = "login";
38 ScreenFactory::ScreenFactory(ScreenObserver* observer,
39 OobeDisplay* oobe_display)
40 : observer_(observer),
41 oobe_display_(oobe_display) {
44 ScreenFactory::~ScreenFactory() {
47 BaseScreen* ScreenFactory::CreateScreen(const std::string& id) {
48 BaseScreen* result = CreateScreenImpl(id);
49 DCHECK_EQ(id, result->GetID());
50 return result;
53 BaseScreen* ScreenFactory::CreateScreenImpl(const std::string& id) {
54 if (id == kNetworkScreenId) {
55 return new NetworkScreen(observer_, oobe_display_->GetNetworkScreenActor());
56 } else if (id == kUpdateScreenId) {
57 return new UpdateScreen(observer_, oobe_display_->GetUpdateScreenActor());
58 } else if (id == kUserImageScreenId) {
59 return new UserImageScreen(observer_,
60 oobe_display_->GetUserImageScreenActor());
61 } else if (id == kEulaScreenId) {
62 return new EulaScreen(observer_, oobe_display_->GetEulaScreenActor());
63 } else if (id == kEnrollmentScreenId) {
64 return new EnrollmentScreen(observer_,
65 oobe_display_->GetEnrollmentScreenActor());
66 } else if (id == kResetScreenId) {
67 return new ResetScreen(observer_, oobe_display_->GetResetScreenActor());
68 } else if (id == kKioskAutolaunchScreenId) {
69 return new KioskAutolaunchScreen(
70 observer_, oobe_display_->GetKioskAutolaunchScreenActor());
71 } else if (id == kTermsOfServiceScreenId) {
72 return new TermsOfServiceScreen(observer_,
73 oobe_display_->GetTermsOfServiceScreenActor());
74 } else if (id == kWrongHWIDScreenId) {
75 return new WrongHWIDScreen(
76 observer_,
77 oobe_display_->GetWrongHWIDScreenActor());
78 } else if (id == kLocallyManagedUserCreationScreenId) {
79 return new LocallyManagedUserCreationScreen(
80 observer_,
81 oobe_display_->GetLocallyManagedUserCreationScreenActor());
82 } else if (id == kErrorScreenId) {
83 return new ErrorScreen(observer_, oobe_display_->GetErrorScreenActor());
86 // TODO(antrim): support for login screen.
87 NOTREACHED() << "Unknown screen ID: " << id;
88 return NULL;
91 } // namespace chromeos