Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 347993002: Put back sign in / sign out / new user handling in the App Launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/app_list_view_delegate.cc
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc
index a67672b81ac0eddc3f2b92fb3decbdfa99201ae8..cb72e8dea639c875b3b0952690410da7cbb41c81 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/url_constants.h"
+#include "components/signin/core/browser/signin_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/user_metrics.h"
@@ -103,10 +104,27 @@ void PopulateUsers(const ProfileInfoCache& profile_info,
AppListViewDelegate::AppListViewDelegate(Profile* profile,
AppListControllerDelegate* controller)
- : controller_(controller), profile_(profile), model_(NULL) {
+ : controller_(controller),
+ profile_(profile),
+ model_(NULL),
+ scoped_observer_(this) {
CHECK(controller_);
+ SigninManagerFactory::GetInstance()->AddObserver(this);
tapted 2014/06/20 07:58:59 nit: Maybe we need a comment here about why we're
benwells 2014/06/20 08:57:12 Done.
+ // Start observing all already-created SigninManagers.
ProfileManager* profile_manager = g_browser_process->profile_manager();
+ std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles();
+ for (std::vector<Profile*>::iterator i = profiles.begin();
+ i != profiles.end();
+ ++i) {
+ SigninManagerBase* manager =
+ SigninManagerFactory::GetForProfileIfExists(*i);
+ if (manager) {
+ DCHECK(!scoped_observer_.IsObserving(manager));
+ scoped_observer_.Add(manager);
+ }
+ }
+
profile_manager->GetProfileInfoCache().AddObserver(this);
app_list::StartPageService* service =
@@ -133,6 +151,10 @@ AppListViewDelegate::~AppListViewDelegate() {
g_browser_process->
profile_manager()->GetProfileInfoCache().RemoveObserver(this);
+ SigninManagerFactory* factory = SigninManagerFactory::GetInstance();
+ if (factory)
+ factory->RemoveObserver(this);
+
// Ensure search controller is released prior to speech_ui_.
search_controller_.reset();
}
@@ -155,6 +177,29 @@ void AppListViewDelegate::OnHotwordRecognized() {
ToggleSpeechRecognition();
}
+void AppListViewDelegate::SigninManagerCreated(SigninManagerBase* manager) {
+ scoped_observer_.Add(manager);
+}
+
+void AppListViewDelegate::SigninManagerShutdown(SigninManagerBase* manager) {
+ if (scoped_observer_.IsObserving(manager))
+ scoped_observer_.Remove(manager);
+}
+
+void AppListViewDelegate::GoogleSigninFailed(
+ const GoogleServiceAuthError& error) {
+ OnProfileChanged();
+}
+
+void AppListViewDelegate::GoogleSigninSucceeded(const std::string& username,
+ const std::string& password) {
+ OnProfileChanged();
+}
+
+void AppListViewDelegate::GoogleSignedOut(const std::string& username) {
+ OnProfileChanged();
+}
+
void AppListViewDelegate::OnProfileChanged() {
model_ = app_list::AppListSyncableServiceFactory::GetForProfile(
profile_)->model();
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | chrome/browser/ui/app_list/test/chrome_app_list_test_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698