Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: chrome/browser/ui/webui/options/manage_profile_handler.cc

Issue 222313005: [Profiles] Download high-res avatars using the --new-profile-management flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: msw comments part 2 Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/ui/webui/options/manage_profile_handler.h" 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/profiles/profile_window.h" 25 #include "chrome/browser/profiles/profile_window.h"
26 #include "chrome/browser/profiles/profiles_state.h" 26 #include "chrome/browser/profiles/profiles_state.h"
27 #include "chrome/browser/signin/signin_manager_factory.h" 27 #include "chrome/browser/signin/signin_manager_factory.h"
28 #include "chrome/browser/sync/profile_sync_service.h" 28 #include "chrome/browser/sync/profile_sync_service.h"
29 #include "chrome/browser/sync/profile_sync_service_factory.h" 29 #include "chrome/browser/sync/profile_sync_service_factory.h"
30 #include "chrome/browser/ui/browser_finder.h" 30 #include "chrome/browser/ui/browser_finder.h"
31 #include "chrome/browser/ui/webui/options/options_handlers_helper.h" 31 #include "chrome/browser/ui/webui/options/options_handlers_helper.h"
32 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
33 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "components/signin/core/browser/signin_manager.h" 34 #include "components/signin/core/browser/signin_manager.h"
35 #include "components/signin/core/common/profile_management_switches.h"
35 #include "content/public/browser/browser_thread.h" 36 #include "content/public/browser/browser_thread.h"
36 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
37 #include "content/public/browser/web_ui.h" 38 #include "content/public/browser/web_ui.h"
38 #include "google_apis/gaia/gaia_auth_util.h" 39 #include "google_apis/gaia/gaia_auth_util.h"
39 #include "grit/generated_resources.h" 40 #include "grit/generated_resources.h"
40 #include "grit/google_chrome_strings.h" 41 #include "grit/google_chrome_strings.h"
41 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
42 #include "ui/base/webui/web_ui_util.h" 43 #include "ui/base/webui/web_ui_util.h"
43 44
44 #if defined(ENABLE_SETTINGS_APP) 45 #if defined(ENABLE_SETTINGS_APP)
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 if (icon_url == gaia_picture_url_) { 342 if (icon_url == gaia_picture_url_) {
342 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, true); 343 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, true);
343 if (!previously_using_gaia_icon) { 344 if (!previously_using_gaia_icon) {
344 // Only log if they changed to the GAIA photo. 345 // Only log if they changed to the GAIA photo.
345 // Selection of GAIA photo as avatar is logged as part of the function 346 // Selection of GAIA photo as avatar is logged as part of the function
346 // below. 347 // below.
347 ProfileMetrics::LogProfileSwitchGaia(ProfileMetrics::GAIA_OPT_IN); 348 ProfileMetrics::LogProfileSwitchGaia(ProfileMetrics::GAIA_OPT_IN);
348 } 349 }
349 } else if (profiles::IsDefaultAvatarIconUrl(icon_url, &new_icon_index)) { 350 } else if (profiles::IsDefaultAvatarIconUrl(icon_url, &new_icon_index)) {
350 ProfileMetrics::LogProfileAvatarSelection(new_icon_index); 351 ProfileMetrics::LogProfileAvatarSelection(new_icon_index);
352
353 if (switches::IsNewAvatarMenu())
msw 2014/04/29 21:17:33 Do other paths that set the profile's icon also ne
noms (inactive) 2014/04/30 15:59:00 Done.
354 cache.DownloadHighResAvatar(new_icon_index);
355
351 PrefService* pref_service = profile->GetPrefs(); 356 PrefService* pref_service = profile->GetPrefs();
352 // Updating the profile preference will cause the cache to be updated for 357 // Updating the profile preference will cause the cache to be updated for
353 // this preference. 358 // this preference.
354 pref_service->SetInteger(prefs::kProfileAvatarIndex, new_icon_index); 359 pref_service->SetInteger(prefs::kProfileAvatarIndex, new_icon_index);
355 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false); 360 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false);
356 } 361 }
357 ProfileMetrics::LogProfileUpdate(profile_file_path); 362 ProfileMetrics::LogProfileUpdate(profile_file_path);
358 363
359 if (profile->IsManaged()) 364 if (profile->IsManaged())
360 return; 365 return;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 g_browser_process->profile_manager()->profile_shortcut_manager(); 520 g_browser_process->profile_manager()->profile_shortcut_manager();
516 DCHECK(shortcut_manager); 521 DCHECK(shortcut_manager);
517 522
518 shortcut_manager->RemoveProfileShortcuts(profile_file_path); 523 shortcut_manager->RemoveProfileShortcuts(profile_file_path);
519 524
520 // Update the UI buttons. 525 // Update the UI buttons.
521 OnHasProfileShortcuts(false); 526 OnHasProfileShortcuts(false);
522 } 527 }
523 528
524 } // namespace options 529 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698