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

Unified Diff: chrome/browser/supervised_user/supervised_user_interstitial.cc

Issue 335833003: Rename "managed (mode|user)" to "supervised user" (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments (+ a few other cleanups) Created 6 years, 6 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/supervised_user/supervised_user_interstitial.cc
diff --git a/chrome/browser/managed_mode/managed_mode_interstitial.cc b/chrome/browser/supervised_user/supervised_user_interstitial.cc
similarity index 77%
rename from chrome/browser/managed_mode/managed_mode_interstitial.cc
rename to chrome/browser/supervised_user/supervised_user_interstitial.cc
index 0aa1c7035ac4c0eb3f4c9c9bf68e99f03565e060..81108837afa104be4bd051911813c18e9a483773 100644
--- a/chrome/browser/managed_mode/managed_mode_interstitial.cc
+++ b/chrome/browser/supervised_user/supervised_user_interstitial.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/managed_mode/managed_mode_interstitial.h"
+#include "chrome/browser/supervised_user/supervised_user_interstitial.h"
#include "base/i18n/rtl.h"
#include "base/metrics/histogram.h"
@@ -10,9 +10,9 @@
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/browser/managed_mode/managed_user_service.h"
-#include "chrome/browser/managed_mode/managed_user_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/supervised_user/supervised_user_service.h"
+#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/common/pref_names.h"
#include "components/infobars/core/infobar.h"
#include "components/infobars/core/infobar_delegate.h"
@@ -34,11 +34,11 @@
using content::BrowserThread;
// static
-void ManagedModeInterstitial::Show(content::WebContents* web_contents,
+void SupervisedUserInterstitial::Show(content::WebContents* web_contents,
const GURL& url,
const base::Callback<void(bool)>& callback) {
- ManagedModeInterstitial* interstitial =
- new ManagedModeInterstitial(web_contents, url, callback);
+ SupervisedUserInterstitial* interstitial =
+ new SupervisedUserInterstitial(web_contents, url, callback);
// If Init() does not complete fully, immediately delete the interstitial.
if (!interstitial->Init())
@@ -46,7 +46,7 @@ void ManagedModeInterstitial::Show(content::WebContents* web_contents,
// Otherwise |interstitial_page_| is responsible for deleting it.
}
-ManagedModeInterstitial::ManagedModeInterstitial(
+SupervisedUserInterstitial::SupervisedUserInterstitial(
content::WebContents* web_contents,
const GURL& url,
const base::Callback<void(bool)>& callback)
@@ -55,9 +55,9 @@ ManagedModeInterstitial::ManagedModeInterstitial(
url_(url),
callback_(callback) {}
-ManagedModeInterstitial::~ManagedModeInterstitial() {}
+SupervisedUserInterstitial::~SupervisedUserInterstitial() {}
-bool ManagedModeInterstitial::Init() {
+bool SupervisedUserInterstitial::Init() {
if (ShouldProceed()) {
// It can happen that the site was only allowed very recently and the URL
// filter on the IO thread had not been updated yet. Proceed with the
@@ -92,22 +92,23 @@ bool ManagedModeInterstitial::Init() {
}
}
- // TODO(bauerb): Extract an observer callback on ManagedUserService for this.
+ // TODO(bauerb): Extract an observer callback on SupervisedUserService for
+ // this.
Profile* profile =
Profile::FromBrowserContext(web_contents_->GetBrowserContext());
PrefService* prefs = profile->GetPrefs();
pref_change_registrar_.Init(prefs);
pref_change_registrar_.Add(
prefs::kDefaultSupervisedUserFilteringBehavior,
- base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged,
+ base::Bind(&SupervisedUserInterstitial::OnFilteringPrefsChanged,
base::Unretained(this)));
pref_change_registrar_.Add(
prefs::kSupervisedUserManualHosts,
- base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged,
+ base::Bind(&SupervisedUserInterstitial::OnFilteringPrefsChanged,
base::Unretained(this)));
pref_change_registrar_.Add(
prefs::kSupervisedUserManualURLs,
- base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged,
+ base::Bind(&SupervisedUserInterstitial::OnFilteringPrefsChanged,
base::Unretained(this)));
languages_ = prefs->GetString(prefs::kAcceptLanguages);
@@ -118,21 +119,21 @@ bool ManagedModeInterstitial::Init() {
return true;
}
-std::string ManagedModeInterstitial::GetHTMLContents() {
+std::string SupervisedUserInterstitial::GetHTMLContents() {
base::DictionaryValue strings;
strings.SetString("blockPageTitle",
l10n_util::GetStringUTF16(IDS_BLOCK_INTERSTITIAL_TITLE));
Profile* profile =
Profile::FromBrowserContext(web_contents_->GetBrowserContext());
- ManagedUserService* managed_user_service =
- ManagedUserServiceFactory::GetForProfile(profile);
+ SupervisedUserService* supervised_user_service =
+ SupervisedUserServiceFactory::GetForProfile(profile);
- bool allow_access_requests = managed_user_service->AccessRequestsEnabled();
+ bool allow_access_requests = supervised_user_service->AccessRequestsEnabled();
strings.SetBoolean("allowAccessRequests", allow_access_requests);
base::string16 custodian =
- base::UTF8ToUTF16(managed_user_service->GetCustodianName());
+ base::UTF8ToUTF16(supervised_user_service->GetCustodianName());
strings.SetString(
"blockPageMessage",
allow_access_requests
@@ -160,7 +161,7 @@ std::string ManagedModeInterstitial::GetHTMLContents() {
return webui::GetI18nTemplateHtml(html, &strings);
}
-void ManagedModeInterstitial::CommandReceived(const std::string& command) {
+void SupervisedUserInterstitial::CommandReceived(const std::string& command) {
// For use in histograms.
enum Commands {
PREVIEW,
@@ -185,9 +186,9 @@ void ManagedModeInterstitial::CommandReceived(const std::string& command) {
Profile* profile =
Profile::FromBrowserContext(web_contents_->GetBrowserContext());
- ManagedUserService* managed_user_service =
- ManagedUserServiceFactory::GetForProfile(profile);
- managed_user_service->AddAccessRequest(url_);
+ SupervisedUserService* supervised_user_service =
+ SupervisedUserServiceFactory::GetForProfile(profile);
+ supervised_user_service->AddAccessRequest(url_);
DVLOG(1) << "Sent access request for " << url_.spec();
return;
@@ -196,34 +197,35 @@ void ManagedModeInterstitial::CommandReceived(const std::string& command) {
NOTREACHED();
}
-void ManagedModeInterstitial::OnProceed() {
+void SupervisedUserInterstitial::OnProceed() {
// CHECK instead of DCHECK as defense in depth in case we'd accidentally
// proceed on a blocked page.
CHECK(ShouldProceed());
DispatchContinueRequest(true);
}
-void ManagedModeInterstitial::OnDontProceed() {
+void SupervisedUserInterstitial::OnDontProceed() {
DispatchContinueRequest(false);
}
-bool ManagedModeInterstitial::ShouldProceed() {
+bool SupervisedUserInterstitial::ShouldProceed() {
Profile* profile =
Profile::FromBrowserContext(web_contents_->GetBrowserContext());
- ManagedUserService* managed_user_service =
- ManagedUserServiceFactory::GetForProfile(profile);
- ManagedModeURLFilter* url_filter =
- managed_user_service->GetURLFilterForUIThread();
+ SupervisedUserService* supervised_user_service =
+ SupervisedUserServiceFactory::GetForProfile(profile);
+ SupervisedUserURLFilter* url_filter =
+ supervised_user_service->GetURLFilterForUIThread();
return url_filter->GetFilteringBehaviorForURL(url_) !=
- ManagedModeURLFilter::BLOCK;
+ SupervisedUserURLFilter::BLOCK;
}
-void ManagedModeInterstitial::OnFilteringPrefsChanged() {
+void SupervisedUserInterstitial::OnFilteringPrefsChanged() {
if (ShouldProceed())
interstitial_page_->Proceed();
}
-void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) {
+void SupervisedUserInterstitial::DispatchContinueRequest(
+ bool continue_request) {
// If there is no history entry to go back to, close the tab instead.
int nav_entry_count = web_contents_->GetController().GetEntryCount();
if (!continue_request && nav_entry_count == 0)

Powered by Google App Engine
This is Rietveld 408576698