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

Side by Side Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 23179002: Update the app launcher menu on profile name change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@le_refactor_gigante_signin_into_model
Patch Set: rebase Created 7 years, 4 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/app_list/app_list_view_delegate.h" 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 : controller_(controller), 58 : controller_(controller),
59 profile_(profile), 59 profile_(profile),
60 model_(NULL) { 60 model_(NULL) {
61 DCHECK(profile_); 61 DCHECK(profile_);
62 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, 62 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
63 content::Source<Profile>(profile_)); 63 content::Source<Profile>(profile_));
64 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, 64 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED,
65 content::Source<Profile>(profile_)); 65 content::Source<Profile>(profile_));
66 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, 66 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
67 content::Source<Profile>(profile_)); 67 content::Source<Profile>(profile_));
68 g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this);
68 } 69 }
69 70
70 AppListViewDelegate::~AppListViewDelegate() { 71 AppListViewDelegate::~AppListViewDelegate() {
71 if (signin_delegate_) 72 if (signin_delegate_)
72 signin_delegate_->RemoveObserver(this); 73 signin_delegate_->RemoveObserver(this);
74 g_browser_process->
75 profile_manager()->GetProfileInfoCache().RemoveObserver(this);
73 } 76 }
74 77
75 void AppListViewDelegate::OnProfileChanged() { 78 void AppListViewDelegate::OnProfileChanged() {
76 model_->SetSignedIn(!signin_delegate_->NeedSignin()); 79 model_->SetSignedIn(!signin_delegate_->NeedSignin());
77 ProfileInfoCache& cache = 80 ProfileInfoCache& cache =
78 g_browser_process->profile_manager()->GetProfileInfoCache(); 81 g_browser_process->profile_manager()->GetProfileInfoCache();
79 // Populate the current user details. 82 // Populate the current user details.
80 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); 83 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
81 // The profile won't exist in the cache if the current app list profile is 84 // The profile won't exist in the cache if the current app list profile is
82 // being deleted. 85 // being deleted.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 void AppListViewDelegate::OnSigninSuccess() { 228 void AppListViewDelegate::OnSigninSuccess() {
226 OnProfileChanged(); 229 OnProfileChanged();
227 } 230 }
228 231
229 void AppListViewDelegate::Observe( 232 void AppListViewDelegate::Observe(
230 int type, 233 int type,
231 const content::NotificationSource& source, 234 const content::NotificationSource& source,
232 const content::NotificationDetails& details) { 235 const content::NotificationDetails& details) {
233 OnProfileChanged(); 236 OnProfileChanged();
234 } 237 }
238
239 void AppListViewDelegate::OnProfileNameChanged(
240 const base::FilePath& profile_path,
241 const base::string16& old_profile_name) {
242 if (profile_->GetPath() != profile_path)
243 return;
244
245 OnProfileChanged();
246 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698