diff options
author | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 10:37:33 +0000 |
---|---|---|
committer | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 10:37:33 +0000 |
commit | 6601da18d9383c11a66d8f73a197ab31a5c279e2 (patch) | |
tree | 1af9b968aab3ae32a1d00abfbfbd784f92d3916d | |
parent | 43770184513cfdd133fb051ea180083dd6810c70 (diff) | |
download | chromium_src-6601da18d9383c11a66d8f73a197ab31a5c279e2.zip chromium_src-6601da18d9383c11a66d8f73a197ab31a5c279e2.tar.gz chromium_src-6601da18d9383c11a66d8f73a197ab31a5c279e2.tar.bz2 |
Merge 113789 - [cros] Use a distinct icon for the guest session.
BUG=chromium-os:22840
TEST=Manual: see bug description
Review URL: http://codereview.chromium.org/8872015
TBR=ivankr@chromium.org
Review URL: http://codereview.chromium.org/8930029
git-svn-id: svn://svn.chromium.org/chrome/branches/963/src@114402 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/views/frame/browser_non_client_frame_view.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_view.cc | 21 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_view.h | 9 |
3 files changed, 32 insertions, 3 deletions
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc index 7499df3..e977d59 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc @@ -38,7 +38,10 @@ void BrowserNonClientFrameView::UpdateAvatarInfo() { if (!avatar_button_.get()) return; - if (browser_view_->IsOffTheRecord()) { + if (browser_view_->IsGuestSession()) { + avatar_button_->SetAvatarIcon( + gfx::Image(new SkBitmap(browser_view_->GetGuestAvatarIcon())), false); + } else if (browser_view_->IsOffTheRecord()) { avatar_button_->SetAvatarIcon( gfx::Image(new SkBitmap(browser_view_->GetOTRAvatarIcon())), false); } else { diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 3faef74..f802830 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -459,6 +459,10 @@ bool BrowserView::IsOffTheRecord() const { return browser_->profile()->IsOffTheRecord(); } +bool BrowserView::IsGuestSession() const { + return browser_->profile()->IsGuestSession(); +} + bool BrowserView::ShouldShowAvatar() const { if (!IsBrowserTypeNormal()) return false; @@ -545,7 +549,7 @@ TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { return browser_->GetSelectedTabContentsWrapper(); } -SkBitmap BrowserView::GetOTRAvatarIcon() { +SkBitmap BrowserView::GetOTRAvatarIcon() const { static SkBitmap* otr_avatar_ = new SkBitmap(); if (otr_avatar_->isNull()) { @@ -555,6 +559,21 @@ SkBitmap BrowserView::GetOTRAvatarIcon() { return *otr_avatar_; } +SkBitmap BrowserView::GetGuestAvatarIcon() const { +#if defined(OS_CHROMEOS) + static SkBitmap* guest_avatar_ = new SkBitmap(); + + if (guest_avatar_->isNull()) { + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + *guest_avatar_ = *rb.GetBitmapNamed(IDR_GUEST_ICON); + } + return *guest_avatar_; +#else + NOTREACHED(); + return SkBitmap(); +#endif +} + #if defined(OS_WIN) && !defined(USE_AURA) void BrowserView::PrepareToRunSystemMenu(HMENU menu) { system_menu_->UpdateStates(); diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 1d8444c..24c010e 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -158,6 +158,10 @@ class BrowserView : public BrowserWindow, // incognito. bool IsOffTheRecord() const; + // Returns true if the profile associated with this Browser window is + // a guest session. + bool IsGuestSession() const; + // Returns true if the non-client view should render an avatar icon. virtual bool ShouldShowAvatar() const; @@ -185,7 +189,10 @@ class BrowserView : public BrowserWindow, TabContentsWrapper* GetSelectedTabContentsWrapper() const; // Retrieves the icon to use in the frame to indicate an OTR window. - SkBitmap GetOTRAvatarIcon(); + SkBitmap GetOTRAvatarIcon() const; + + // Retrieves the icon to use in the frame to indicate guest session. + SkBitmap GetGuestAvatarIcon() const; #if defined(OS_WIN) // Called right before displaying the system menu to allow the BrowserView |