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

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

Issue 1248613003: Issue 501916 : Add data type counts to profile deletion flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First draft Created 5 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
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/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 base::Unretained(this))); 185 base::Unretained(this)));
186 web_ui()->RegisterMessageCallback("refreshGaiaPicture", 186 web_ui()->RegisterMessageCallback("refreshGaiaPicture",
187 base::Bind(&ManageProfileHandler::RefreshGaiaPicture, 187 base::Bind(&ManageProfileHandler::RefreshGaiaPicture,
188 base::Unretained(this))); 188 base::Unretained(this)));
189 web_ui()->RegisterMessageCallback( 189 web_ui()->RegisterMessageCallback(
190 "showDisconnectManagedProfileDialog", 190 "showDisconnectManagedProfileDialog",
191 base::Bind(&ManageProfileHandler::ShowDisconnectManagedProfileDialog, 191 base::Bind(&ManageProfileHandler::ShowDisconnectManagedProfileDialog,
192 base::Unretained(this))); 192 base::Unretained(this)));
193 web_ui()->RegisterMessageCallback("logDeleteUserDialogShown", 193 web_ui()->RegisterMessageCallback("logDeleteUserDialogShown",
194 base::Bind(&HandleLogDeleteUserDialogShown)); 194 base::Bind(&HandleLogDeleteUserDialogShown));
195 web_ui()->RegisterMessageCallback(
196 "deleteUserDialogLoadStats",
197 base::Bind(&ManageProfileHandler::DeleteUserDialogLoadStats,
198 base::Unretained(this)));
195 } 199 }
196 200
197 void ManageProfileHandler::Uninitialize() { 201 void ManageProfileHandler::Uninitialize() {
198 g_browser_process->profile_manager()-> 202 g_browser_process->profile_manager()->
199 GetProfileInfoCache().RemoveObserver(this); 203 GetProfileInfoCache().RemoveObserver(this);
200 } 204 }
201 205
202 void ManageProfileHandler::OnProfileAdded(const base::FilePath& profile_path) { 206 void ManageProfileHandler::OnProfileAdded(const base::FilePath& profile_path) {
203 SendExistingProfileNames(); 207 SendExistingProfileNames();
204 } 208 }
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 shortcut_manager->RemoveProfileShortcuts(profile_file_path); 559 shortcut_manager->RemoveProfileShortcuts(profile_file_path);
556 560
557 // Update the UI buttons. 561 // Update the UI buttons.
558 OnHasProfileShortcuts(false); 562 OnHasProfileShortcuts(false);
559 } 563 }
560 564
561 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { 565 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) {
562 profiles::UpdateGaiaProfileInfoIfNeeded(Profile::FromWebUI(web_ui())); 566 profiles::UpdateGaiaProfileInfoIfNeeded(Profile::FromWebUI(web_ui()));
563 } 567 }
564 568
569 void ManageProfileHandler::DeleteUserDialogLoadStats(
570 const base::ListValue* args) {
571 base::FilePath* profile_path = new base::FilePath();
572 if (!GetProfilePathFromArgs(args, profile_path))
573 return;
574
575 Profile* profile = g_browser_process->profile_manager()->
576 GetProfileByPath(*profile_path);
577
578 if (!profile) return;
579
580 // Store the task tracker and temporary states.
581 profile_statistics_service_.reset(new profiles::ProfileStatisticsService(
582 profile,
583 base::Bind(
584 &ManageProfileHandler::DeleteUserDialogLoadStatsCallback,
585 weak_factory_.GetWeakPtr(),
586 base::Owned(profile_path))));
587 }
588
589 void ManageProfileHandler::DeleteUserDialogLoadStatsCallback(
590 const base::FilePath* profile_path,
591 profiles::ProfileStatisticsService::ProfileStatisticsValues result) {
592 // Copy result into return_value.
593 base::StringValue return_profile_path(profile_path->value());
594 base::DictionaryValue return_value;
595 for (profiles::ProfileStatisticsService::ProfileStatisticsValues::iterator
596 iter = result.begin(); iter != result.end(); iter++) {
597 return_value.SetIntegerWithoutPathExpansion(iter->first, iter->second);
598 }
599 web_ui()->CallJavascriptFunction("ManageProfileOverlay.updateDeleteDialog",
600 return_profile_path, return_value);
601 }
602
565 } // namespace options 603 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698