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

Unified Diff: chrome/browser/ui/webui/history_ui.cc

Issue 14046016: History UI: Apply the pref that prohibits deleting browsing and download history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove executable flag Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/history_ui.cc
===================================================================
--- chrome/browser/ui/webui/history_ui.cc (revision 193987)
+++ chrome/browser/ui/webui/history_ui.cc (working copy)
@@ -102,10 +102,12 @@
static const char kDeviceTypeTablet[] = "tablet";
content::WebUIDataSource* CreateHistoryUIHTMLSource(Profile* profile) {
+ PrefService* prefs = profile->GetPrefs();
+
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIHistoryFrameHost);
source->AddBoolean("isUserSignedIn",
- !profile->GetPrefs()->GetString(prefs::kGoogleServicesUsername).empty());
+ !prefs->GetString(prefs::kGoogleServicesUsername).empty());
source->AddLocalizedString("collapseSessionMenuItemText",
IDS_NEW_TAB_OTHER_SESSIONS_COLLAPSE_SESSION);
source->AddLocalizedString("expandSessionMenuItemText",
@@ -161,6 +163,9 @@
source->AddBoolean("groupByDomain",
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kHistoryEnableGroupByDomain));
+ source->AddBoolean("allowDeletingHistory",
+ prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory));
+
source->SetJsonPath(kStringsJsFile);
source->AddResourcePath(kHistoryJsFile, IDR_HISTORY_JS);
source->AddResourcePath(kOtherDevicesJsFile, IDR_OTHER_DEVICES_JS);
@@ -554,12 +559,17 @@
}
void BrowsingHistoryHandler::HandleRemoveVisits(const ListValue* args) {
+ Profile* profile = Profile::FromWebUI(web_ui());
+ if (!profile->GetPrefs()->GetBoolean(prefs::kAllowDeletingBrowserHistory)) {
Patrick Dubroy 2013/04/18 14:15:19 Maybe just OR this onto the other condition below?
Pam (message me for reviews) 2013/04/18 14:41:44 Done. Done. Done. I'll spare you the spam. It's al
+ web_ui()->CallJavascriptFunction("deleteFailed");
+ return;
+ }
+
if (delete_task_tracker_.HasTrackedTasks()) {
web_ui()->CallJavascriptFunction("deleteFailed");
return;
}
- Profile* profile = Profile::FromWebUI(web_ui());
HistoryService* history_service =
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS);
history::WebHistoryService* web_history =

Powered by Google App Engine
This is Rietveld 408576698