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

Unified Diff: chrome/browser/ui/views/frame/glass_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: copy paste the right function 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/glass_browser_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
index 4eaaf0647767725b64d2b1ea8db8a70f7f093b33..98c51aba64543e763ea859b42478efade8fbd5c1 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -8,7 +8,6 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/app/chrome_dll_resource.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_header_helper.h"
#include "chrome/browser/themes/theme_properties.h"
@@ -19,7 +18,6 @@
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "components/signin/core/common/profile_management_switches.h"
-#include "content/public/browser/notification_service.h"
#include "grit/theme_resources.h"
#include "skia/ext/image_operations.h"
#include "ui/base/resource/resource_bundle_win.h"
@@ -101,11 +99,6 @@ GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame,
UpdateNewStyleAvatarInfo(this, NewAvatarButton::NATIVE_BUTTON);
else
UpdateAvatarInfo();
-
- if (!browser_view->IsOffTheRecord()) {
- registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
- content::NotificationService::AllSources());
- }
}
GlassBrowserFrameView::~GlassBrowserFrameView() {
@@ -594,23 +587,35 @@ void GlassBrowserFrameView::DisplayNextThrobberFrame() {
reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_]));
}
-void GlassBrowserFrameView::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::NATIVE_BUTTON);
- } else {
- UpdateAvatarInfo();
- }
- break;
- default:
- NOTREACHED() << "Got a notification we didn't register for!";
- break;
- }
+void GlassBrowserFrameView::OnProfileAdded(const base::FilePath& profile_path) {
+ if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu())
rpetterson 2015/02/07 00:04:58 I feel like I'm seeing this update code frequently
noms (inactive) 2015/02/12 21:46:02 Done.
+ UpdateNewStyleAvatarInfo(this, NewAvatarButton::NATIVE_BUTTON);
+ else
+ UpdateAvatarInfo();
+}
+
+void GlassBrowserFrameView::OnProfileWasRemoved(
+ const base::FilePath& profile_path,
+ const base::string16& profile_name) {
+ if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu())
+ UpdateNewStyleAvatarInfo(this, NewAvatarButton::NATIVE_BUTTON);
+ else
+ UpdateAvatarInfo();
+}
+
+void GlassBrowserFrameView::OnProfileNameChanged(
+ const base::FilePath& profile_path,
+ const base::string16& old_profile_name) {
+ // Profile names are only displayed in the new UI.
+ if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu())
+ UpdateNewStyleAvatarInfo(this, NewAvatarButton::NATIVE_BUTTON);
+}
+
+void GlassBrowserFrameView::OnProfileAvatarChanged(
+ const base::FilePath& profile_path) {
+ // Profile avatars are only displayed in the old UI or incognito.
+ if (browser_view()->IsOffTheRecord() || !switches::IsNewAvatarMenu())
+ UpdateAvatarInfo();
}
// static

Powered by Google App Engine
This is Rietveld 408576698