OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profiles/profiles_state.h" | 5 #include "chrome/browser/profiles/profiles_state.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/profiles/profile_avatar_downloader.h" | |
14 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | |
13 #include "chrome/browser/profiles/profile_info_cache.h" | 15 #include "chrome/browser/profiles/profile_info_cache.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
16 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
18 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
19 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 21 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
20 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
21 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
22 | 24 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 accounts.erase(primary_index); | 108 accounts.erase(primary_index); |
107 | 109 |
108 return accounts; | 110 return accounts; |
109 } | 111 } |
110 | 112 |
111 bool IsRegularOrGuestSession(Browser* browser) { | 113 bool IsRegularOrGuestSession(Browser* browser) { |
112 Profile* profile = browser->profile(); | 114 Profile* profile = browser->profile(); |
113 return profile->IsGuestSession() || !profile->IsOffTheRecord(); | 115 return profile->IsGuestSession() || !profile->IsOffTheRecord(); |
114 } | 116 } |
115 | 117 |
118 void DownloadHighResAvatarIfNeeded(size_t icon_index) { | |
119 // TODO(noms): We should check whether the file already exists on disk | |
msw
2014/04/28 20:46:37
This seems like a fairly straightforward duty of P
noms (inactive)
2014/04/29 19:12:27
We'd like to test it for a bit, given that it's su
| |
120 // before trying to re-download it. For now, since this is behind a flag and | |
121 // the resources are still changing, re-download it every time the profile | |
msw
2014/04/28 20:46:37
What is the plan going forward if the resources ch
noms (inactive)
2014/04/29 19:12:27
I don't think we plan to do any versioning. The id
| |
122 // avatar changes, to make sure we have the latest copy. | |
123 ProfileInfoCache* cache = | |
124 &g_browser_process->profile_manager()->GetProfileInfoCache(); | |
125 | |
126 // Start the download for this file. The cache takes ownership of the | |
127 // |avatar_downloader|, which will be deleted when the download completes, or | |
128 // if that never happens, when the ProfileInfoCache is destroyed. | |
129 ProfileAvatarDownloader* avatar_dowloader = new ProfileAvatarDownloader( | |
msw
2014/04/28 20:46:37
Is this object leaked if DownloadHighResAvatar ret
noms (inactive)
2014/04/29 19:12:27
Ah yes, this is much better. This didn't work befo
| |
130 g_browser_process->system_request_context(), | |
msw
2014/04/28 20:46:37
Can't ProfileAvatarDownloader obtain this value in
noms (inactive)
2014/04/29 19:12:27
Done.
| |
131 icon_index, | |
132 cache); | |
133 cache->DownloadHighResAvatar(avatar_dowloader, icon_index); | |
134 } | |
135 | |
116 } // namespace profiles | 136 } // namespace profiles |
OLD | NEW |