OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/profiles/profile_info_cache.h" | 9 #include "chrome/browser/profiles/profile_info_cache.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 } else if (avatar_button_.get()) { | 32 } else if (avatar_button_.get()) { |
33 RemoveChildView(avatar_button_.get()); | 33 RemoveChildView(avatar_button_.get()); |
34 avatar_button_.reset(); | 34 avatar_button_.reset(); |
35 frame_->GetRootView()->Layout(); | 35 frame_->GetRootView()->Layout(); |
36 } | 36 } |
37 | 37 |
38 if (!avatar_button_.get()) | 38 if (!avatar_button_.get()) |
39 return; | 39 return; |
40 | 40 |
41 if (browser_view_->IsGuestSession()) { | 41 if (browser_view_->IsOffTheRecord()) { |
42 avatar_button_->SetAvatarIcon( | |
43 gfx::Image(new SkBitmap(browser_view_->GetGuestAvatarIcon())), false); | |
44 } else if (browser_view_->IsOffTheRecord()) { | |
45 avatar_button_->SetAvatarIcon( | 42 avatar_button_->SetAvatarIcon( |
46 gfx::Image(new SkBitmap(browser_view_->GetOTRAvatarIcon())), false); | 43 gfx::Image(new SkBitmap(browser_view_->GetOTRAvatarIcon())), false); |
47 } else { | 44 } else { |
48 ProfileInfoCache& cache = | 45 ProfileInfoCache& cache = |
49 g_browser_process->profile_manager()->GetProfileInfoCache(); | 46 g_browser_process->profile_manager()->GetProfileInfoCache(); |
50 Profile* profile = browser_view_->browser()->profile(); | 47 Profile* profile = browser_view_->browser()->profile(); |
51 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 48 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
52 if (index != std::string::npos) { | 49 if (index != std::string::npos) { |
53 bool is_gaia_picture = | 50 bool is_gaia_picture = |
54 cache.IsUsingGAIAPictureOfProfileAtIndex(index) && | 51 cache.IsUsingGAIAPictureOfProfileAtIndex(index) && |
55 cache.GetGAIAPictureOfProfileAtIndex(index); | 52 cache.GetGAIAPictureOfProfileAtIndex(index); |
56 avatar_button_->SetAvatarIcon( | 53 avatar_button_->SetAvatarIcon( |
57 cache.GetAvatarIconOfProfileAtIndex(index), is_gaia_picture); | 54 cache.GetAvatarIconOfProfileAtIndex(index), is_gaia_picture); |
58 avatar_button_->SetText(cache.GetNameOfProfileAtIndex(index)); | 55 avatar_button_->SetText(cache.GetNameOfProfileAtIndex(index)); |
59 } | 56 } |
60 } | 57 } |
61 } | 58 } |
OLD | NEW |