OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/views/profiles/avatar_base_button.h" | |
6 | |
7 #include "base/files/file_path.h" | |
8 #include "base/strings/string16.h" | |
9 #include "chrome/browser/browser_process.h" | |
10 #include "chrome/browser/profiles/profile_manager.h" | |
11 #include "chrome/browser/ui/browser.h" | |
12 #include "components/signin/core/common/profile_management_switches.h" | |
13 | |
14 AvatarBaseButton::AvatarBaseButton(Browser* browser) | |
15 : browser_(browser) { | |
16 g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this); | |
17 } | |
18 | |
19 AvatarBaseButton::~AvatarBaseButton() { | |
20 g_browser_process->profile_manager()-> | |
21 GetProfileInfoCache().RemoveObserver(this); | |
22 } | |
23 | |
24 void AvatarBaseButton::OnProfileAdded(const base::FilePath& profile_path) { | |
25 Update(); | |
26 } | |
27 | |
28 void AvatarBaseButton::OnProfileWasRemoved( | |
29 const base::FilePath& profile_path, | |
30 const base::string16& profile_name) { | |
31 // If deleting the active profile, don't bother updating the avatar | |
32 // button, as the browser window is being closed anyway. | |
33 if (browser_->profile()->GetPath() != profile_path) | |
34 Update(); | |
35 } | |
36 | |
37 void AvatarBaseButton::OnProfileNameChanged( | |
38 const base::FilePath& profile_path, | |
39 const base::string16& old_profile_name) { | |
40 if (browser_->profile()->GetPath() == profile_path) | |
41 Update(); | |
42 } | |
43 | |
44 void AvatarBaseButton::OnProfileAvatarChanged( | |
45 const base::FilePath& profile_path) { | |
46 if (!switches::IsNewAvatarMenu() && | |
47 browser_->profile()->GetPath() == profile_path) | |
48 Update(); | |
49 } | |
50 | |
51 void AvatarBaseButton::OnProfileSupervisedUserIdChanged( | |
52 const base::FilePath& profile_path) { | |
53 if (browser_->profile()->GetPath() == profile_path) | |
54 Update(); | |
55 } | |
56 | |
57 void AvatarBaseButton::Update() { | |
58 NOTREACHED(); | |
msw
2015/04/01 01:30:16
Why not make this pure-virtual?
yao
2015/04/10 00:43:32
Done.
| |
59 } | |
OLD | NEW |