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

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

Issue 8790010: Adding in metrics for GAIA photo info. Also, fixing avatar logging to only log when the user chan... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // index. 167 // index.
168 profile_index = cache.GetIndexOfProfileWithPath(profile_file_path); 168 profile_index = cache.GetIndexOfProfileWithPath(profile_file_path);
169 if (profile_index == std::string::npos) 169 if (profile_index == std::string::npos)
170 return; 170 return;
171 } 171 }
172 172
173 std::string icon_url; 173 std::string icon_url;
174 if (!args->GetString(2, &icon_url)) 174 if (!args->GetString(2, &icon_url))
175 return; 175 return;
176 176
177 // Metrics logging variable.
178 bool previously_using_gaia_icon =
179 cache.IsUsingGAIANameOfProfileAtIndex(profile_index);
180
177 size_t new_icon_index; 181 size_t new_icon_index;
178 if (icon_url == gaia_picture_url_) { 182 if (icon_url == gaia_picture_url_) {
179 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, true); 183 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, true);
184 if (!previously_using_gaia_icon) {
185 // Only log if they changed to the GAIA photo.
186 ProfileMetrics::LogProfileAvatarSelection(ProfileMetrics::AVATAR_GAIA);
187 ProfileMetrics::LogProfileSwitchGaia(ProfileMetrics::GAIA_OPT_IN);
188 }
180 } else if (cache.IsDefaultAvatarIconUrl(icon_url, &new_icon_index)) { 189 } else if (cache.IsDefaultAvatarIconUrl(icon_url, &new_icon_index)) {
181 ProfileMetrics::LogProfileAvatarSelection(new_icon_index); 190 size_t previous_icon_index =
191 cache.GetAvatarIconIndexOfProfileAtIndex(profile_index);
192 if (previous_icon_index != new_icon_index) {
193 ProfileMetrics::LogProfileAvatarSelection(new_icon_index);
194 }
195 if (previously_using_gaia_icon) {
196 ProfileMetrics::LogProfileSwitchGaia(ProfileMetrics::GAIA_OPT_OUT);
197 }
182 cache.SetAvatarIconOfProfileAtIndex(profile_index, new_icon_index); 198 cache.SetAvatarIconOfProfileAtIndex(profile_index, new_icon_index);
183 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false); 199 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false);
184 } 200 }
185 201
186 ProfileMetrics::LogProfileUpdate(profile_file_path); 202 ProfileMetrics::LogProfileUpdate(profile_file_path);
187 } 203 }
188 204
189 void ManageProfileHandler::DeleteProfile(const ListValue* args) { 205 void ManageProfileHandler::DeleteProfile(const ListValue* args) {
190 DCHECK(args); 206 DCHECK(args);
191 207
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (i == std::string::npos) 297 if (i == std::string::npos)
282 return; 298 return;
283 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i); 299 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i);
284 if (gaia_name.empty()) 300 if (gaia_name.empty())
285 return; 301 return;
286 302
287 StringValue gaia_name_value(gaia_name); 303 StringValue gaia_name_value(gaia_name);
288 web_ui_->CallJavascriptFunction("ManageProfileOverlay.setProfileName", 304 web_ui_->CallJavascriptFunction("ManageProfileOverlay.setProfileName",
289 gaia_name_value); 305 gaia_name_value);
290 } 306 }
OLDNEW
« chrome/browser/profiles/profile_metrics.cc ('K') | « chrome/browser/profiles/profile_metrics.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698