Chromium Code Reviews| 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 = |