| OLD | NEW |
| 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/views/frame/browser_non_client_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/managed_mode.h" | 8 #include "chrome/browser/managed_mode.h" |
| 9 #include "chrome/browser/profiles/avatar_menu_model.h" | 9 #include "chrome/browser/profiles/avatar_menu_model.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } else if (avatar_button_.get()) { | 37 } else if (avatar_button_.get()) { |
| 38 RemoveChildView(avatar_button_.get()); | 38 RemoveChildView(avatar_button_.get()); |
| 39 avatar_button_.reset(); | 39 avatar_button_.reset(); |
| 40 frame_->GetRootView()->Layout(); | 40 frame_->GetRootView()->Layout(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 43 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 44 gfx::Image avatar; | 44 gfx::Image avatar; |
| 45 string16 text; | 45 string16 text; |
| 46 bool is_gaia_picture = false; | 46 bool is_gaia_picture = false; |
| 47 if (browser_view_->IsGuestSession()) { | 47 if (browser_view_->IsOffTheRecord()) { |
| 48 #if defined(OS_CHROMEOS) | |
| 49 avatar = rb.GetImageNamed(IDR_GUEST_ICON); | |
| 50 #else | |
| 51 NOTREACHED(); | |
| 52 #endif | |
| 53 } else if (browser_view_->IsOffTheRecord()) { | |
| 54 avatar = rb.GetImageNamed(browser_view_->GetOTRIconResourceID()); | 48 avatar = rb.GetImageNamed(browser_view_->GetOTRIconResourceID()); |
| 55 } else if (ManagedMode::IsInManagedMode()) { | 49 } else if (ManagedMode::IsInManagedMode()) { |
| 56 avatar = rb.GetImageNamed(IDR_MANAGED_MODE_AVATAR); | 50 avatar = rb.GetImageNamed(IDR_MANAGED_MODE_AVATAR); |
| 57 } else if (AvatarMenuModel::ShouldShowAvatarMenu()) { | 51 } else if (AvatarMenuModel::ShouldShowAvatarMenu()) { |
| 58 ProfileInfoCache& cache = | 52 ProfileInfoCache& cache = |
| 59 g_browser_process->profile_manager()->GetProfileInfoCache(); | 53 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 60 Profile* profile = browser_view_->browser()->profile(); | 54 Profile* profile = browser_view_->browser()->profile(); |
| 61 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 55 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
| 62 if (index == std::string::npos) | 56 if (index == std::string::npos) |
| 63 return; | 57 return; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 85 | 79 |
| 86 void BrowserNonClientFrameView::VisibilityChanged(views::View* starting_from, | 80 void BrowserNonClientFrameView::VisibilityChanged(views::View* starting_from, |
| 87 bool is_visible) { | 81 bool is_visible) { |
| 88 if (!is_visible) | 82 if (!is_visible) |
| 89 return; | 83 return; |
| 90 // The first time UpdateAvatarInfo() is called the window is not visible so | 84 // The first time UpdateAvatarInfo() is called the window is not visible so |
| 91 // DrawTaskBarDecoration() has no effect. Therefore we need to call it again | 85 // DrawTaskBarDecoration() has no effect. Therefore we need to call it again |
| 92 // once the window is visible. | 86 // once the window is visible. |
| 93 UpdateAvatarInfo(); | 87 UpdateAvatarInfo(); |
| 94 } | 88 } |
| OLD | NEW |