diff options
author | nkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 10:11:10 +0000 |
---|---|---|
committer | nkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 10:11:10 +0000 |
commit | 8ddb1c2557d6a1f67375efd803a40b704d6fe12b (patch) | |
tree | a09ef4075321215e25d0ce41769edb64b6f16523 /chrome/browser | |
parent | 0c1a691abd70e8830c4255ad4e64e4e9f4cf70fd (diff) | |
download | chromium_src-8ddb1c2557d6a1f67375efd803a40b704d6fe12b.zip chromium_src-8ddb1c2557d6a1f67375efd803a40b704d6fe12b.tar.gz chromium_src-8ddb1c2557d6a1f67375efd803a40b704d6fe12b.tar.bz2 |
Show help topic dialog with "Can't access your account" for online/offline cases.
Create HelpAppLauncher and LoginHtmlDialog instances only once.
BUG= http://crosbug.com/6379
TEST=Tried on 3 cases: network not connected/connected but no internet (offline), connected to internet (online help topic)
Review URL: http://codereview.chromium.org/3294012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
5 files changed, 46 insertions, 9 deletions
diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc index af0e023..e3f71ac 100644 --- a/chrome/browser/chromeos/login/eula_view.cc +++ b/chrome/browser/chromeos/login/eula_view.cc @@ -301,7 +301,8 @@ void EulaView::ButtonPressed(views::Button* sender, const views::Event& event) { void EulaView::LinkActivated(views::Link* source, int event_flags) { if (source == learn_more_link_) { - help_app_.reset(new HelpAppLauncher(GetNativeWindow())); + if (!help_app_.get()) + help_app_.reset(new HelpAppLauncher(GetNativeWindow())); help_app_->ShowHelpTopic(HelpAppLauncher::HELP_STATS_USAGE); } else if (source == system_security_settings_link_) { // TODO(glotov): Handle TPM link click. diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 9bb7d14..32e83c0 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -22,6 +22,7 @@ #include "chrome/browser/chromeos/cros/network_library.h" #include "chrome/browser/chromeos/login/authenticator.h" #include "chrome/browser/chromeos/login/background_view.h" +#include "chrome/browser/chromeos/login/help_app_launcher.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/chromeos/login/login_utils.h" #include "chrome/browser/chromeos/login/message_bubble.h" @@ -82,7 +83,9 @@ ExistingUserController::ExistingUserController( background_view_(NULL), selected_view_index_(kNotSelected), num_login_attempts_(0), - bubble_(NULL) { + bubble_(NULL), + last_login_error_(GoogleServiceAuthError::NONE), + login_timed_out_(false) { if (delete_scheduled_instance_) delete_scheduled_instance_->Delete(); @@ -305,6 +308,8 @@ void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { LOG(INFO) << "OnLoginFailure"; ClearCaptchaState(); + last_login_error_ = failure.error(); + login_timed_out_ = failure.reason() == LoginFailure::LOGIN_TIMED_OUT; std::string error = failure.GetErrorString(); // Check networking after trying to login in case user is @@ -446,8 +451,20 @@ void ExistingUserController::OnPasswordChangeDetected( } void ExistingUserController::OnHelpLinkActivated() { - AddStartUrl(GetAccountRecoveryHelpUrl()); - LoginOffTheRecord(); + DCHECK(last_login_error_.state() != GoogleServiceAuthError::NONE); + if (!help_app_.get()) + help_app_.reset(new HelpAppLauncher(GetNativeWindow())); + switch (last_login_error_.state()) { + case(GoogleServiceAuthError::CONNECTION_FAILED): + help_app_->ShowHelpTopic( + HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE); + break; + default: + help_app_->ShowHelpTopic(login_timed_out_ ? + HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE : + HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); + break; + } } void ExistingUserController::OnCaptchaEntered(const std::string& captcha) { diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h index 6281eb3..c5eaa2a 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.h +++ b/chrome/browser/chromeos/login/existing_user_controller.h @@ -10,6 +10,7 @@ #include <vector> #include "base/ref_counted.h" +#include "base/scoped_ptr.h" #include "base/task.h" #include "base/timer.h" #include "chrome/browser/chromeos/login/background_view.h" @@ -21,11 +22,13 @@ #include "chrome/browser/chromeos/login/user_controller.h" #include "chrome/browser/chromeos/wm_message_listener.h" #include "chrome/common/net/gaia/gaia_auth_consumer.h" +#include "chrome/common/net/gaia/google_service_auth_error.h" #include "gfx/size.h" namespace chromeos { class Authenticator; +class HelpAppLauncher; class MessageBubble; // ExistingUserController is used to handle login when someone has already @@ -173,6 +176,16 @@ class ExistingUserController : public WmMessageListener::Observer, // Cached credentials data when password change is detected. GaiaAuthConsumer::ClientLoginResult cached_credentials_; + // Represents last error that was encountered when communicating to signin + // server. GoogleServiceAuthError::NONE if none. + GoogleServiceAuthError last_login_error_; + + // True if last login has failed with LOGIN_TIMED_OUT error. + bool login_timed_out_; + + // Help application used for help dialogs. + scoped_ptr<HelpAppLauncher> help_app_; + DISALLOW_COPY_AND_ASSIGN(ExistingUserController); }; diff --git a/chrome/browser/chromeos/login/help_app_launcher.cc b/chrome/browser/chromeos/login/help_app_launcher.cc index 74479b8..b7d2fdc 100644 --- a/chrome/browser/chromeos/login/help_app_launcher.cc +++ b/chrome/browser/chromeos/login/help_app_launcher.cc @@ -68,11 +68,15 @@ void HelpAppLauncher::ShowHelpTopic(HelpTopic help_topic_id) { // HelpApp, private: void HelpAppLauncher::ShowHelpTopicDialog(const GURL& topic_url) { - dialog_.reset(new LoginHtmlDialog( - this, - parent_window_, - l10n_util::GetString(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE), - topic_url)); + if (!dialog_.get()) { + dialog_.reset(new LoginHtmlDialog( + this, + parent_window_, + l10n_util::GetString(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE), + topic_url)); + } else { + dialog_->set_url(topic_url); + } dialog_->Show(); } diff --git a/chrome/browser/chromeos/login/login_html_dialog.h b/chrome/browser/chromeos/login/login_html_dialog.h index 672bed6..367bb56 100644 --- a/chrome/browser/chromeos/login/login_html_dialog.h +++ b/chrome/browser/chromeos/login/login_html_dialog.h @@ -38,6 +38,8 @@ class LoginHtmlDialog : public HtmlDialogUIDelegate { // Overrides default width/height for dialog. void SetDialogSize(int width, int height); + void set_url(const GURL& url) { url_ = url; } + protected: // HtmlDialogUIDelegate implementation. virtual bool IsDialogModal() const { return true; } |