11320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// Copyright (c) 2012 The Chromium Authors. All rights reserved.
21320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// Use of this source code is governed by a BSD-style license that can be
31320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// found in the LICENSE file.
41320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
51320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "chrome/browser/chromeos/login/screen_manager.h"
61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
71320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccinamespace chromeos {
81320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
91320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciScreenManager::ScreenManager() {
101320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciScreenManager::~ScreenManager() {
131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciWizardScreen* ScreenManager::GetScreen(const std::string& screen_name) {
161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  ScreenMap::const_iterator iter = screens_.find(screen_name);
171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  if (iter != screens_.end()) {
181320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    return iter->second.get();
191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  WizardScreen* result = CreateScreen(screen_name);
211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  DCHECK(result) << "Can not create screen named " << screen_name;
221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  screens_[screen_name] = make_linked_ptr(result);
231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  return result;
241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccibool ScreenManager::HasScreen(const std::string& screen_name) {
271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  return screens_.count(screen_name) > 0;
281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}  // namespace chromeos
31