| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/login_manager_view.h" | 5 #include "chrome/browser/chromeos/login/login_manager_view.h" | 
| 6 | 6 | 
| 7 #include <signal.h> | 7 #include <signal.h> | 
| 8 #include <sys/types.h> | 8 #include <sys/types.h> | 
| 9 | 9 | 
| 10 #include <algorithm> | 10 #include <algorithm> | 
| 11 #include <vector> | 11 #include <vector> | 
| 12 | 12 | 
| 13 #include "app/l10n_util.h" | 13 #include "app/l10n_util.h" | 
| 14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" | 
| 15 #include "base/callback.h" | 15 #include "base/callback.h" | 
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" | 
| 17 #include "base/keyboard_codes.h" | 17 #include "base/keyboard_codes.h" | 
| 18 #include "base/logging.h" | 18 #include "base/logging.h" | 
| 19 #include "base/process_util.h" | 19 #include "base/process_util.h" | 
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" | 
| 21 #include "chrome/browser/chromeos/cros/cros_library.h" | 21 #include "chrome/browser/chromeos/cros/cros_library.h" | 
| 22 #include "chrome/browser/chromeos/cros/network_library.h" | 22 #include "chrome/browser/chromeos/cros/network_library.h" | 
| 23 #include "chrome/browser/chromeos/login/authentication_notification_details.h" | 23 #include "chrome/browser/chromeos/login/authentication_notification_details.h" | 
|  | 24 #include "chrome/browser/chromeos/login/login_utils.h" | 
| 24 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 25 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 
| 25 #include "chrome/browser/chromeos/login/screen_observer.h" | 26 #include "chrome/browser/chromeos/login/screen_observer.h" | 
| 26 #include "chrome/browser/chromeos/login/user_manager.h" | 27 #include "chrome/browser/chromeos/login/user_manager.h" | 
| 27 #include "chrome/browser/chromeos/login/utils.h" |  | 
| 28 #include "chrome/common/notification_service.h" | 28 #include "chrome/common/notification_service.h" | 
| 29 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" | 
| 30 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" | 
| 31 #include "views/controls/button/native_button.h" | 31 #include "views/controls/button/native_button.h" | 
| 32 #include "views/controls/label.h" | 32 #include "views/controls/label.h" | 
| 33 #include "views/widget/widget.h" | 33 #include "views/widget/widget.h" | 
| 34 #include "views/window/non_client_view.h" | 34 #include "views/window/non_client_view.h" | 
| 35 #include "views/window/window.h" | 35 #include "views/window/window.h" | 
| 36 #include "views/window/window_gtk.h" | 36 #include "views/window/window_gtk.h" | 
| 37 | 37 | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 71       error_label_(NULL), | 71       error_label_(NULL), | 
| 72       sign_in_button_(NULL), | 72       sign_in_button_(NULL), | 
| 73       create_account_button_(NULL), | 73       create_account_button_(NULL), | 
| 74       observer_(observer), | 74       observer_(observer), | 
| 75       error_id_(-1), | 75       error_id_(-1), | 
| 76       ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), | 76       ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), | 
| 77       focus_delayed_(false) { | 77       focus_delayed_(false) { | 
| 78   if (kStubOutLogin) | 78   if (kStubOutLogin) | 
| 79     authenticator_.reset(new StubAuthenticator(this)); | 79     authenticator_.reset(new StubAuthenticator(this)); | 
| 80   else | 80   else | 
| 81     authenticator_.reset(login_utils::CreateAuthenticator(this)); | 81     authenticator_.reset(LoginUtils::Get()->CreateAuthenticator(this)); | 
| 82 |  | 
| 83 } | 82 } | 
| 84 | 83 | 
| 85 LoginManagerView::~LoginManagerView() { | 84 LoginManagerView::~LoginManagerView() { | 
| 86 } | 85 } | 
| 87 | 86 | 
| 88 void LoginManagerView::Init() { | 87 void LoginManagerView::Init() { | 
| 89   // Use rounded rect background. | 88   // Use rounded rect background. | 
| 90   views::Painter* painter = CreateWizardPainter( | 89   views::Painter* painter = CreateWizardPainter( | 
| 91       &BorderDefinition::kScreenBorder); | 90       &BorderDefinition::kScreenBorder); | 
| 92   set_background( | 91   set_background( | 
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 334     ShowError(IDS_LOGIN_ERROR_AUTHENTICATING); | 333     ShowError(IDS_LOGIN_ERROR_AUTHENTICATING); | 
| 335   // TODO(someone): get |error| onto the UI somehow? | 334   // TODO(someone): get |error| onto the UI somehow? | 
| 336 } | 335 } | 
| 337 | 336 | 
| 338 void LoginManagerView::OnLoginSuccess(const std::string username, | 337 void LoginManagerView::OnLoginSuccess(const std::string username, | 
| 339                                       std::vector<std::string> cookies) { | 338                                       std::vector<std::string> cookies) { | 
| 340   // TODO(cmasone): something sensible if errors occur. | 339   // TODO(cmasone): something sensible if errors occur. | 
| 341   if (observer_) { | 340   if (observer_) { | 
| 342     observer_->OnExit(ScreenObserver::LOGIN_SIGN_IN_SELECTED); | 341     observer_->OnExit(ScreenObserver::LOGIN_SIGN_IN_SELECTED); | 
| 343   } | 342   } | 
| 344   login_utils::CompleteLogin(username, cookies); | 343   LoginUtils::Get()->CompleteLogin(username, cookies); | 
| 345 } | 344 } | 
| 346 | 345 | 
| 347 void LoginManagerView::ShowError(int error_id) { | 346 void LoginManagerView::ShowError(int error_id) { | 
| 348   error_id_ = error_id; | 347   error_id_ = error_id; | 
| 349   error_label_->SetText((error_id_ == -1) | 348   error_label_->SetText((error_id_ == -1) | 
| 350                         ? std::wstring() | 349                         ? std::wstring() | 
| 351                         : l10n_util::GetString(error_id_)); | 350                         : l10n_util::GetString(error_id_)); | 
| 352 } | 351 } | 
| 353 | 352 | 
| 354 bool LoginManagerView::HandleKeystroke(views::Textfield* s, | 353 bool LoginManagerView::HandleKeystroke(views::Textfield* s, | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 381   return false; | 380   return false; | 
| 382 } | 381 } | 
| 383 | 382 | 
| 384 void LoginManagerView::OnOSVersion( | 383 void LoginManagerView::OnOSVersion( | 
| 385     VersionLoader::Handle handle, | 384     VersionLoader::Handle handle, | 
| 386     std::string version) { | 385     std::string version) { | 
| 387   os_version_label_->SetText(ASCIIToWide(version)); | 386   os_version_label_->SetText(ASCIIToWide(version)); | 
| 388 } | 387 } | 
| 389 | 388 | 
| 390 }  // namespace chromeos | 389 }  // namespace chromeos | 
| OLD | NEW | 
|---|