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

Side by Side Diff: chrome/browser/chromeos/login/screens/user_image_screen.h

Issue 1130603006: Added histograms for tracking new user's priority prefs sync time and results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h"
10 #include "chrome/browser/chromeos/camera_presence_notifier.h" 11 #include "chrome/browser/chromeos/camera_presence_notifier.h"
11 #include "chrome/browser/chromeos/login/screens/base_screen.h" 12 #include "chrome/browser/chromeos/login/screens/base_screen.h"
12 #include "chrome/browser/chromeos/login/screens/user_image_model.h" 13 #include "chrome/browser/chromeos/login/screens/user_image_model.h"
13 #include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h" 14 #include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h"
14 #include "chrome/browser/image_decoder.h" 15 #include "chrome/browser/image_decoder.h"
15 #include "components/user_manager/user.h" 16 #include "components/user_manager/user.h"
16 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
18 19
19 namespace base { 20 namespace base {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 69
69 // CameraPresenceNotifier::Observer implementation: 70 // CameraPresenceNotifier::Observer implementation:
70 void OnCameraPresenceCheckDone(bool is_camera_present) override; 71 void OnCameraPresenceCheckDone(bool is_camera_present) override;
71 72
72 // UserImageSyncObserver::Observer implementation: 73 // UserImageSyncObserver::Observer implementation:
73 void OnInitialSync(bool local_image_updated) override; 74 void OnInitialSync(bool local_image_updated) override;
74 75
75 bool user_selected_image() const { return user_has_selected_image_; } 76 bool user_selected_image() const { return user_has_selected_image_; }
76 77
77 private: 78 private:
79 enum class SyncResult { SUCCEED, TIMED_OUT };
80
78 // Called when whaiting for sync timed out. 81 // Called when whaiting for sync timed out.
79 void OnSyncTimeout(); 82 void OnSyncTimeout();
80 83
81 bool IsWaitingForSync() const; 84 bool IsWaitingForSync() const;
82 85
83 // Called when the policy::key::kUserAvatarImage policy changes while the 86 // Called when the policy::key::kUserAvatarImage policy changes while the
84 // screen is being shown. If the policy is set, closes the screen because the 87 // screen is being shown. If the policy is set, closes the screen because the
85 // user is not allowed to override a policy-set image. 88 // user is not allowed to override a policy-set image.
86 void OnUserImagePolicyChanged(const base::Value* previous, 89 void OnUserImagePolicyChanged(const base::Value* previous,
87 const base::Value* current); 90 const base::Value* current);
88 91
89 // Returns current user. 92 // Returns current user.
90 const user_manager::User* GetUser(); 93 const user_manager::User* GetUser();
91 94
92 // Returns UserImageManager for the current user. 95 // Returns UserImageManager for the current user.
93 UserImageManager* GetUserImageManager(); 96 UserImageManager* GetUserImageManager();
94 97
95 // Returns UserImageSyncObserver for the current user. 98 // Returns UserImageSyncObserver for the current user.
96 UserImageSyncObserver* GetSyncObserver(); 99 UserImageSyncObserver* GetSyncObserver();
97 100
98 // Called when it's decided not to skip the screen. 101 // Called when it's decided not to skip the screen.
99 void HideCurtain(); 102 void HideCurtain();
100 103
101 // Closes the screen. 104 // Closes the screen.
102 void ExitScreen(); 105 void ExitScreen();
103 106
107 // Reports sync duration and result to UMA.
108 void ReportSyncResult(SyncResult timed_out) const;
109
104 content::NotificationRegistrar notification_registrar_; 110 content::NotificationRegistrar notification_registrar_;
105 111
106 scoped_ptr<policy::PolicyChangeRegistrar> policy_registrar_; 112 scoped_ptr<policy::PolicyChangeRegistrar> policy_registrar_;
107 113
108 UserImageView* view_; 114 UserImageView* view_;
109 115
110 // Last user photo, if taken. 116 // Last user photo, if taken.
111 gfx::ImageSkia user_photo_; 117 gfx::ImageSkia user_photo_;
112 118
113 // If |true|, decoded photo should be immediately accepted (i.e., both 119 // If |true|, decoded photo should be immediately accepted (i.e., both
114 // HandleTakePhoto and HandleImageAccepted have already been called but we're 120 // HandleTakePhoto and HandleImageAccepted have already been called but we're
115 // still waiting for photo image decoding to finish. 121 // still waiting for photo image decoding to finish.
116 bool accept_photo_after_decoding_; 122 bool accept_photo_after_decoding_;
117 123
118 // Index of the selected user image. 124 // Index of the selected user image.
119 int selected_image_; 125 int selected_image_;
120 126
121 // Timer used for waiting for user image sync. 127 // Timer used for waiting for user image sync.
122 scoped_ptr<base::Timer> sync_timer_; 128 scoped_ptr<base::Timer> sync_timer_;
123 129
124 // If screen ready to be shown. 130 // If screen ready to be shown.
125 bool is_screen_ready_; 131 bool is_screen_ready_;
126 132
127 // True if user has explicitly selected some image. 133 // True if user has explicitly selected some image.
128 bool user_has_selected_image_; 134 bool user_has_selected_image_;
129 135
136 // The time when we started wait for user image sync.
137 base::Time sync_waiting_start_time_;
138
130 DISALLOW_COPY_AND_ASSIGN(UserImageScreen); 139 DISALLOW_COPY_AND_ASSIGN(UserImageScreen);
131 }; 140 };
132 141
133 } // namespace chromeos 142 } // namespace chromeos
134 143
135 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ 144 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698