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

Unified Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

Issue 895803003: [Profiles] Remove the NotificationService from the ProfileInfoCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cait nit Created 5 years, 10 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/views/frame/opaque_browser_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index 1815dea8947f52d17ae09f7f3716cbbba7450272..6784cbafe96dec19c3a861e8a46393968b22251d 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -10,7 +10,6 @@
#include "base/compiler_specific.h"
#include "base/prefs/pref_service.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/signin/signin_header_helper.h"
#include "chrome/browser/themes/theme_properties.h"
@@ -147,15 +146,7 @@ OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame,
window_title_->set_id(VIEW_ID_WINDOW_TITLE);
AddChildView(window_title_);
- if (browser_view->IsRegularOrGuestSession() && switches::IsNewAvatarMenu())
- UpdateNewStyleAvatarInfo(this, NewAvatarButton::THEMED_BUTTON);
- else
- UpdateAvatarInfo();
-
- if (!browser_view->IsOffTheRecord()) {
- registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
- content::NotificationService::AllSources());
- }
+ UpdateAvatar(this, NewAvatarButton::THEMED_BUTTON);
platform_observer_.reset(OpaqueBrowserFrameViewPlatformSpecific::Create(
this, layout_, browser_view->browser()->profile()));
@@ -369,23 +360,28 @@ gfx::ImageSkia OpaqueBrowserFrameView::GetFaviconForTabIconView() {
///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, protected:
-void OpaqueBrowserFrameView::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (type) {
- case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED:
- if (browser_view() ->IsRegularOrGuestSession() &&
- switches::IsNewAvatarMenu()) {
- UpdateNewStyleAvatarInfo(this, NewAvatarButton::THEMED_BUTTON);
- } else {
- UpdateAvatarInfo();
- }
- break;
- default:
- NOTREACHED() << "Got a notification we didn't register for!";
- break;
- }
+void OpaqueBrowserFrameView::OnProfileAdded(
+ const base::FilePath& profile_path) {
+ UpdateAvatar(this, NewAvatarButton::THEMED_BUTTON);
+}
+
+void OpaqueBrowserFrameView::OnProfileWasRemoved(
+ const base::FilePath& profile_path,
+ const base::string16& profile_name) {
+ UpdateAvatar(this, NewAvatarButton::THEMED_BUTTON);
+}
+
+void OpaqueBrowserFrameView::OnProfileNameChanged(
+ const base::FilePath& profile_path,
+ const base::string16& old_profile_name) {
+ UpdateAvatar(this, NewAvatarButton::THEMED_BUTTON);
+}
+
+void OpaqueBrowserFrameView::OnProfileAvatarChanged(
+ const base::FilePath& profile_path) {
+ // Profile avatars are only displayed in the old UI or incognito.
+ if (browser_view()->IsOffTheRecord() || !switches::IsNewAvatarMenu())
+ UpdateAvatarInfo();
}
///////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698