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

Side by Side Diff: chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc

Issue 402133003: [cros, user_manager] Move default user images constants and helper functions out of src/chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-format Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/login/users/avatar/user_image_sync_observer.h" 5 #include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_change_registrar.h" 8 #include "base/prefs/pref_change_registrar.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/chromeos/login/screens/user_image_screen.h" 12 #include "chrome/browser/chromeos/login/screens/user_image_screen.h"
13 #include "chrome/browser/chromeos/login/users/avatar/default_user_images.h"
14 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" 13 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h"
15 #include "chrome/browser/chromeos/login/users/user.h" 14 #include "chrome/browser/chromeos/login/users/user.h"
16 #include "chrome/browser/chromeos/login/wizard_controller.h" 15 #include "chrome/browser/chromeos/login/wizard_controller.h"
17 #include "chrome/browser/chromeos/profiles/profile_helper.h" 16 #include "chrome/browser/chromeos/profiles/profile_helper.h"
18 #include "chrome/browser/prefs/pref_service_syncable.h" 17 #include "chrome/browser/prefs/pref_service_syncable.h"
19 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "components/user_manager/user_image/default_user_images.h"
22 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
23 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 24
25 namespace chromeos { 25 namespace chromeos {
26 namespace { 26 namespace {
27 27
28 // A dictionary containing info about user image. 28 // A dictionary containing info about user image.
29 const char kUserImageInfo[] = "user_image_info"; 29 const char kUserImageInfo[] = "user_image_info";
30 // Path to value with image index. 30 // Path to value with image index.
31 const char kImageIndex[] = "image_index"; 31 const char kImageIndex[] = "image_index";
32 32
33 bool IsIndexSupported(int index) { 33 bool IsIndexSupported(int index) {
34 return (index >= kFirstDefaultImageIndex && index < kDefaultImagesCount) || 34 return (index >= user_manager::kFirstDefaultImageIndex &&
35 (index == User::kProfileImageIndex); 35 index < user_manager::kDefaultImagesCount) ||
36 (index == User::kProfileImageIndex);
36 } 37 }
37 38
38 Profile* GetUserProfile() { 39 Profile* GetUserProfile() {
39 ProfileManager* profile_manager = g_browser_process->profile_manager(); 40 ProfileManager* profile_manager = g_browser_process->profile_manager();
40 if (!profile_manager || !profile_manager->IsLoggedIn()) 41 if (!profile_manager || !profile_manager->IsLoggedIn())
41 return NULL; 42 return NULL;
42 base::FilePath profile_path = profile_manager->user_data_dir().Append( 43 base::FilePath profile_path = profile_manager->user_data_dir().Append(
43 profile_manager->GetInitialProfileDir()); 44 profile_manager->GetInitialProfileDir());
44 return profile_manager->GetProfileByPath(profile_path); 45 return profile_manager->GetProfileByPath(profile_path);
45 } 46 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (wizard_controller->current_screen() == screen) { 204 if (wizard_controller->current_screen() == screen) {
204 if (screen->user_selected_image()) 205 if (screen->user_selected_image())
205 return false; 206 return false;
206 } 207 }
207 } 208 }
208 return true; 209 return true;
209 } 210 }
210 211
211 } // namespace chromeos 212 } // namespace chromeos
212 213
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc ('k') | chrome/browser/chromeos/login/users/user.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698