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

Unified Diff: chrome/browser/profiles/avatar_menu_model.cc

Issue 12379014: Hide add new profile menu entry for managed users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extract avatar_menu_bubble_view.cc Created 7 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
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model.h ('k') | chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/avatar_menu_model.cc
diff --git a/chrome/browser/profiles/avatar_menu_model.cc b/chrome/browser/profiles/avatar_menu_model.cc
index b44f7ba64c03d6e446ce82113ff4302d5b06fd9a..2cef044b5337f06bb09c89f3f9b2634b441ab1ec 100644
--- a/chrome/browser/profiles/avatar_menu_model.cc
+++ b/chrome/browser/profiles/avatar_menu_model.cc
@@ -29,6 +29,11 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#if defined(ENABLE_MANAGED_USERS)
+#include "chrome/browser/managed_mode/managed_user_service.h"
+#include "chrome/browser/managed_mode/managed_user_service_factory.h"
+#endif
+
using content::BrowserThread;
namespace {
@@ -162,6 +167,20 @@ const AvatarMenuModel::Item& AvatarMenuModel::GetItemAt(size_t index) {
return *items_[index];
}
+bool AvatarMenuModel::ShouldShowAddNewProfileLink() const {
+#if defined(ENABLE_MANAGED_USERS)
+ Profile* active_profile = NULL;
+ if (!browser_)
+ active_profile = ProfileManager::GetLastUsedProfile();
+ else
+ active_profile = browser_->profile();
+ ManagedUserService* service = ManagedUserServiceFactory::GetForProfile(
+ active_profile);
+ return !service->ProfileIsManaged();
+#endif
+ return true;
+}
+
void AvatarMenuModel::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model.h ('k') | chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698