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

Side by Side Diff: chrome/browser/ui/webui/history_ui.cc

Issue 697693004: Supervised users: if history recording is off, allow incognito and deleting history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/history_ui.h" 5 #include "chrome/browser/ui/webui/history_ui.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 source->AddLocalizedString("hasSyncedResults", 170 source->AddLocalizedString("hasSyncedResults",
171 IDS_HISTORY_HAS_SYNCED_RESULTS); 171 IDS_HISTORY_HAS_SYNCED_RESULTS);
172 source->AddLocalizedString("noSyncedResults", IDS_HISTORY_NO_SYNCED_RESULTS); 172 source->AddLocalizedString("noSyncedResults", IDS_HISTORY_NO_SYNCED_RESULTS);
173 source->AddLocalizedString("cancel", IDS_CANCEL); 173 source->AddLocalizedString("cancel", IDS_CANCEL);
174 source->AddLocalizedString("deleteConfirm", 174 source->AddLocalizedString("deleteConfirm",
175 IDS_HISTORY_DELETE_PRIOR_VISITS_CONFIRM_BUTTON); 175 IDS_HISTORY_DELETE_PRIOR_VISITS_CONFIRM_BUTTON);
176 source->AddLocalizedString("bookmarked", IDS_HISTORY_ENTRY_BOOKMARKED); 176 source->AddLocalizedString("bookmarked", IDS_HISTORY_ENTRY_BOOKMARKED);
177 source->AddLocalizedString("entrySummary", IDS_HISTORY_ENTRY_SUMMARY); 177 source->AddLocalizedString("entrySummary", IDS_HISTORY_ENTRY_SUMMARY);
178 source->AddBoolean("isFullHistorySyncEnabled", 178 source->AddBoolean("isFullHistorySyncEnabled",
179 WebHistoryServiceFactory::GetForProfile(profile) != NULL); 179 WebHistoryServiceFactory::GetForProfile(profile) != NULL);
180 source->AddBoolean("groupByDomain", 180 source->AddBoolean("groupByDomain", profile->IsSupervised() ||
181 CommandLine::ForCurrentProcess()->HasSwitch( 181 CommandLine::ForCurrentProcess()->HasSwitch(
182 switches::kHistoryEnableGroupByDomain)); 182 switches::kHistoryEnableGroupByDomain));
183 source->AddBoolean("allowDeletingHistory", 183 bool allow_deleting_history =
184 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory)); 184 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory);
185 source->AddBoolean("allowDeletingHistory", allow_deleting_history);
185 source->AddBoolean("isInstantExtendedApiEnabled", 186 source->AddBoolean("isInstantExtendedApiEnabled",
186 chrome::IsInstantExtendedAPIEnabled()); 187 chrome::IsInstantExtendedAPIEnabled());
188 source->AddBoolean("isSupervisedProfile", profile->IsSupervised());
189 source->AddBoolean("hideDeleteVisitUI",
190 profile->IsSupervised() && !allow_deleting_history);
187 191
188 source->SetJsonPath(kStringsJsFile); 192 source->SetJsonPath(kStringsJsFile);
189 source->AddResourcePath(kHistoryJsFile, IDR_HISTORY_JS); 193 source->AddResourcePath(kHistoryJsFile, IDR_HISTORY_JS);
190 source->AddResourcePath(kOtherDevicesJsFile, IDR_OTHER_DEVICES_JS); 194 source->AddResourcePath(kOtherDevicesJsFile, IDR_OTHER_DEVICES_JS);
191 source->SetDefaultResource(IDR_HISTORY_HTML); 195 source->SetDefaultResource(IDR_HISTORY_HTML);
192 source->DisableDenyXFrameOptions(); 196 source->DisableDenyXFrameOptions();
193 source->AddBoolean("isSupervisedProfile", profile->IsSupervised());
194 source->AddBoolean("showDeleteVisitUI", !profile->IsSupervised());
195 197
196 return source; 198 return source;
197 } 199 }
198 200
199 // Returns a localized version of |visit_time| including a relative 201 // Returns a localized version of |visit_time| including a relative
200 // indicator (e.g. today, yesterday). 202 // indicator (e.g. today, yesterday).
201 base::string16 getRelativeDateLocalized(const base::Time& visit_time) { 203 base::string16 getRelativeDateLocalized(const base::Time& visit_time) {
202 base::Time midnight = base::Time::Now().LocalMidnight(); 204 base::Time midnight = base::Time::Now().LocalMidnight();
203 base::string16 date_str = ui::TimeFormat::RelativeDate(visit_time, &midnight); 205 base::string16 date_str = ui::TimeFormat::RelativeDate(visit_time, &midnight);
204 if (date_str.empty()) { 206 if (date_str.empty()) {
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 Profile* profile = Profile::FromWebUI(web_ui); 1020 Profile* profile = Profile::FromWebUI(web_ui);
1019 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); 1021 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile));
1020 } 1022 }
1021 1023
1022 // static 1024 // static
1023 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( 1025 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes(
1024 ui::ScaleFactor scale_factor) { 1026 ui::ScaleFactor scale_factor) {
1025 return ResourceBundle::GetSharedInstance(). 1027 return ResourceBundle::GetSharedInstance().
1026 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); 1028 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor);
1027 } 1029 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698