diff options
author | michaelpg@chromium.org <michaelpg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-28 16:25:51 +0000 |
---|---|---|
committer | michaelpg@chromium.org <michaelpg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-28 16:25:51 +0000 |
commit | 8e37b2cd5b2cab800f48c8546113c284c57ca0b1 (patch) | |
tree | da93341dd643a4299f11218490d20739d3c086b4 /chrome/browser/ui/ash | |
parent | ac685c4c6758e105d86f17267317012f12628577 (diff) | |
download | chromium_src-8e37b2cd5b2cab800f48c8546113c284c57ca0b1.zip chromium_src-8e37b2cd5b2cab800f48c8546113c284c57ca0b1.tar.gz chromium_src-8e37b2cd5b2cab800f48c8546113c284c57ca0b1.tar.bz2 |
SyncGlobalError refactor and Ash notification.
Same deal as issue 172853009:
Auth errors currently show up in the wrench menu as GlobalErrors. This CL
removes auth errors from the wrench menu in Chrome OS and in Windows when
using the Ash shell, showing notifications instead.
The behavior when clicking these notifications should be the same as
when clicking the toolbar menu error -- showing the sync setup dialog in
the Settings page.
The error-checking logic has been refactored into the new SyncErrorController,
which now exposes the error status to the UI classes.
The UI classes, SyncGlobalError and SyncErrorNotifier, are keyed services
instantiated by the UI.
BUG=128948
TEST=unit_tests --gtest_filter=S*n*Error*
R=stevenjb@chromium.org, atwilson@chromium.org, derat@chromium.org, ben@chromium.org
Review URL: https://codereview.chromium.org/207603002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/ash')
-rw-r--r-- | chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/ash/chrome_shell_delegate_views.cc | 29 |
2 files changed, 27 insertions, 6 deletions
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc index 0939238..2a481af 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc @@ -27,6 +27,7 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" #include "chrome/browser/speech/tts_controller.h" +#include "chrome/browser/sync/sync_error_notifier_factory_ash.h" #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" @@ -276,8 +277,9 @@ void ChromeShellDelegate::Observe(int type, Profile* profile = content::Details<Profile>(details).ptr(); if (!chromeos::ProfileHelper::IsSigninProfile(profile) && !profile->IsGuestSession() && !profile->IsManaged()) { - // Start the error notifier service to show auth notifications. + // Start the error notifier services to show auth/sync notifications. SigninErrorNotifierFactory::GetForProfile(profile); + SyncErrorNotifierFactory::GetForProfile(profile); } ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); break; diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc index 210d41c..1ce1cc0 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc @@ -4,6 +4,8 @@ #include "chrome/browser/ui/ash/chrome_shell_delegate.h" +#include <vector> + #include "ash/accessibility_delegate.h" #include "ash/magnifier/magnifier_constants.h" #include "ash/media_delegate.h" @@ -11,11 +13,13 @@ #include "ash/wm/window_util.h" #include "base/command_line.h" #include "chrome/browser/accessibility/accessibility_events.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" +#include "chrome/browser/sync/sync_error_notifier_factory_ash.h" #include "chrome/browser/ui/ash/chrome_new_window_delegate.h" #include "chrome/browser/ui/ash/session_state_delegate_views.h" #include "chrome/browser/ui/browser.h" @@ -197,10 +201,22 @@ void ChromeShellDelegate::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case chrome::NOTIFICATION_ASH_SESSION_STARTED: { - Profile* profile = ProfileManager::GetActiveUserProfile(); - // Start the error notifier service to show auth notifications. + case chrome::NOTIFICATION_PROFILE_ADDED: { + // Start the error notifier services to show sync/auth notifications. + Profile* profile = content::Source<Profile>(source).ptr(); SigninErrorNotifierFactory::GetForProfile(profile); + SyncErrorNotifierFactory::GetForProfile(profile); + break; + } + case chrome::NOTIFICATION_ASH_SESSION_STARTED: { + // Start the error notifier services for the already loaded profiles. + const std::vector<Profile*> profiles = + g_browser_process->profile_manager()->GetLoadedProfiles(); + for (std::vector<Profile*>::const_iterator it = profiles.begin(); + it != profiles.end(); ++it) { + SigninErrorNotifierFactory::GetForProfile(*it); + SyncErrorNotifierFactory::GetForProfile(*it); + } #if defined(OS_WIN) // If we are launched to service a windows 8 search request then let the @@ -227,7 +243,7 @@ void ChromeShellDelegate::Observe(int type, dummy, chrome::startup::IS_NOT_FIRST_RUN); startup_impl.Launch( - profile, + ProfileManager::GetActiveUserProfile(), std::vector<GURL>(), true, chrome::HOST_DESKTOP_TYPE_ASH); @@ -240,7 +256,7 @@ void ChromeShellDelegate::Observe(int type, } chrome::ScopedTabbedBrowserDisplayer displayer( - profile, + ProfileManager::GetActiveUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH); chrome::AddTabAt(displayer.browser(), GURL(), -1, true); } @@ -256,6 +272,9 @@ void ChromeShellDelegate::Observe(int type, void ChromeShellDelegate::PlatformInit() { #if defined(OS_WIN) registrar_.Add(this, + chrome::NOTIFICATION_PROFILE_ADDED, + content::NotificationService::AllSources()); + registrar_.Add(this, chrome::NOTIFICATION_ASH_SESSION_STARTED, content::NotificationService::AllSources()); registrar_.Add(this, |