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

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: Fixed .gypi 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
« no previous file with comments | « chrome/browser/ui/webui/history_ui.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/history_ui.cc
===================================================================
--- chrome/browser/ui/webui/history_ui.cc (revision 196121)
+++ 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",
@@ -164,6 +166,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);
@@ -560,12 +565,13 @@
}
void BrowsingHistoryHandler::HandleRemoveVisits(const ListValue* args) {
- if (delete_task_tracker_.HasTrackedTasks()) {
+ Profile* profile = Profile::FromWebUI(web_ui());
+ if (delete_task_tracker_.HasTrackedTasks() ||
+ !profile->GetPrefs()->GetBoolean(prefs::kAllowDeletingBrowserHistory)) {
web_ui()->CallJavascriptFunction("deleteFailed");
return;
}
- Profile* profile = Profile::FromWebUI(web_ui());
HistoryService* history_service =
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS);
history::WebHistoryService* web_history =
« no previous file with comments | « chrome/browser/ui/webui/history_ui.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698