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

Unified Diff: chrome/browser/supervised_user/supervised_user_navigation_observer.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_navigation_observer.cc
diff --git a/chrome/browser/managed_mode/managed_mode_navigation_observer.cc b/chrome/browser/supervised_user/supervised_user_navigation_observer.cc
similarity index 67%
rename from chrome/browser/managed_mode/managed_mode_navigation_observer.cc
rename to chrome/browser/supervised_user/supervised_user_navigation_observer.cc
index cec59589f7962600f8a1a1f7a8402b4baa532ca7..42be21eba97aa8e93b8cf2060975389d24862338 100644
--- a/chrome/browser/managed_mode/managed_mode_navigation_observer.cc
+++ b/chrome/browser/supervised_user/supervised_user_navigation_observer.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_navigation_observer.h"
+#include "chrome/browser/supervised_user/supervised_user_navigation_observer.h"
#include "base/bind.h"
#include "base/callback.h"
@@ -12,12 +12,12 @@
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/browser/managed_mode/managed_mode_interstitial.h"
-#include "chrome/browser/managed_mode/managed_mode_resource_throttle.h"
-#include "chrome/browser/managed_mode/managed_mode_url_filter.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_interstitial.h"
+#include "chrome/browser/supervised_user/supervised_user_resource_throttle.h"
+#include "chrome/browser/supervised_user/supervised_user_service.h"
+#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
+#include "chrome/browser/supervised_user/supervised_user_url_filter.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "components/infobars/core/infobar.h"
@@ -75,17 +75,17 @@ void GoBackToSafety(content::WebContents* web_contents) {
}
#endif
-// ManagedModeWarningInfoBarDelegate ------------------------------------------
+// SupervisedUserWarningInfoBarDelegate ---------------------------------------
-class ManagedModeWarningInfoBarDelegate : public ConfirmInfoBarDelegate {
+class SupervisedUserWarningInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
- // Creates a managed mode warning infobar and delegate and adds the infobar to
- // |infobar_service|. Returns the infobar if it was successfully added.
+ // Creates a supervised user warning infobar and delegate and adds the infobar
+ // to |infobar_service|. Returns the infobar if it was successfully added.
static infobars::InfoBar* Create(InfoBarService* infobar_service);
private:
- ManagedModeWarningInfoBarDelegate();
- virtual ~ManagedModeWarningInfoBarDelegate();
+ SupervisedUserWarningInfoBarDelegate();
+ virtual ~SupervisedUserWarningInfoBarDelegate();
// ConfirmInfoBarDelegate:
virtual bool ShouldExpire(const NavigationDetails& details) const OVERRIDE;
@@ -95,52 +95,52 @@ class ManagedModeWarningInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
virtual bool Accept() OVERRIDE;
- DISALLOW_COPY_AND_ASSIGN(ManagedModeWarningInfoBarDelegate);
+ DISALLOW_COPY_AND_ASSIGN(SupervisedUserWarningInfoBarDelegate);
};
// static
-infobars::InfoBar* ManagedModeWarningInfoBarDelegate::Create(
+infobars::InfoBar* SupervisedUserWarningInfoBarDelegate::Create(
InfoBarService* infobar_service) {
return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar(
scoped_ptr<ConfirmInfoBarDelegate>(
- new ManagedModeWarningInfoBarDelegate())));
+ new SupervisedUserWarningInfoBarDelegate())));
}
-ManagedModeWarningInfoBarDelegate::ManagedModeWarningInfoBarDelegate()
+SupervisedUserWarningInfoBarDelegate::SupervisedUserWarningInfoBarDelegate()
: ConfirmInfoBarDelegate() {
}
-ManagedModeWarningInfoBarDelegate::~ManagedModeWarningInfoBarDelegate() {
+SupervisedUserWarningInfoBarDelegate::~SupervisedUserWarningInfoBarDelegate() {
}
-bool ManagedModeWarningInfoBarDelegate::ShouldExpire(
+bool SupervisedUserWarningInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
- // ManagedModeNavigationObserver removes us below.
+ // SupervisedUserNavigationObserver removes us below.
return false;
}
-void ManagedModeWarningInfoBarDelegate::InfoBarDismissed() {
+void SupervisedUserWarningInfoBarDelegate::InfoBarDismissed() {
content::WebContents* web_contents =
InfoBarService::WebContentsFromInfoBar(infobar());
- ManagedModeNavigationObserver::FromWebContents(
+ SupervisedUserNavigationObserver::FromWebContents(
web_contents)->WarnInfoBarDismissed();
}
-base::string16 ManagedModeWarningInfoBarDelegate::GetMessageText() const {
+base::string16 SupervisedUserWarningInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringUTF16(IDS_MANAGED_USER_WARN_INFOBAR_MESSAGE);
}
-int ManagedModeWarningInfoBarDelegate::GetButtons() const {
+int SupervisedUserWarningInfoBarDelegate::GetButtons() const {
return BUTTON_OK;
}
-base::string16 ManagedModeWarningInfoBarDelegate::GetButtonLabel(
+base::string16 SupervisedUserWarningInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
DCHECK_EQ(BUTTON_OK, button);
return l10n_util::GetStringUTF16(IDS_MANAGED_USER_WARN_INFOBAR_GO_BACK);
}
-bool ManagedModeWarningInfoBarDelegate::Accept() {
+bool SupervisedUserWarningInfoBarDelegate::Accept() {
#if defined(OS_ANDROID)
// TODO(bauerb): Get rid of the platform-specific #ifdef here.
// http://crbug.com/313377
@@ -155,35 +155,36 @@ bool ManagedModeWarningInfoBarDelegate::Accept() {
} // namespace
-// ManagedModeNavigationObserver ----------------------------------------------
+// SupervisedUserNavigationObserver -------------------------------------------
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(ManagedModeNavigationObserver);
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(SupervisedUserNavigationObserver);
-ManagedModeNavigationObserver::~ManagedModeNavigationObserver() {
+SupervisedUserNavigationObserver::~SupervisedUserNavigationObserver() {
}
-ManagedModeNavigationObserver::ManagedModeNavigationObserver(
+SupervisedUserNavigationObserver::SupervisedUserNavigationObserver(
content::WebContents* web_contents)
: WebContentsObserver(web_contents),
warn_infobar_(NULL) {
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
- managed_user_service_ = ManagedUserServiceFactory::GetForProfile(profile);
- url_filter_ = managed_user_service_->GetURLFilterForUIThread();
+ supervised_user_service_ =
+ SupervisedUserServiceFactory::GetForProfile(profile);
+ url_filter_ = supervised_user_service_->GetURLFilterForUIThread();
}
-void ManagedModeNavigationObserver::WarnInfoBarDismissed() {
+void SupervisedUserNavigationObserver::WarnInfoBarDismissed() {
DCHECK(warn_infobar_);
warn_infobar_ = NULL;
}
-void ManagedModeNavigationObserver::ProvisionalChangeToMainFrameUrl(
+void SupervisedUserNavigationObserver::ProvisionalChangeToMainFrameUrl(
const GURL& url,
content::RenderFrameHost* render_frame_host) {
- ManagedModeURLFilter::FilteringBehavior behavior =
+ SupervisedUserURLFilter::FilteringBehavior behavior =
url_filter_->GetFilteringBehaviorForURL(url);
- if (behavior == ManagedModeURLFilter::WARN || !warn_infobar_)
+ if (behavior == SupervisedUserURLFilter::WARN || !warn_infobar_)
return;
// If we shouldn't have a warn infobar remove it here.
@@ -191,7 +192,7 @@ void ManagedModeNavigationObserver::ProvisionalChangeToMainFrameUrl(
warn_infobar_ = NULL;
}
-void ManagedModeNavigationObserver::DidCommitProvisionalLoadForFrame(
+void SupervisedUserNavigationObserver::DidCommitProvisionalLoadForFrame(
int64 frame_id,
const base::string16& frame_unique_name,
bool is_main_frame,
@@ -202,17 +203,17 @@ void ManagedModeNavigationObserver::DidCommitProvisionalLoadForFrame(
return;
DVLOG(1) << "DidCommitProvisionalLoadForFrame " << url.spec();
- ManagedModeURLFilter::FilteringBehavior behavior =
+ SupervisedUserURLFilter::FilteringBehavior behavior =
url_filter_->GetFilteringBehaviorForURL(url);
- if (behavior == ManagedModeURLFilter::WARN && !warn_infobar_) {
- warn_infobar_ = ManagedModeWarningInfoBarDelegate::Create(
+ if (behavior == SupervisedUserURLFilter::WARN && !warn_infobar_) {
+ warn_infobar_ = SupervisedUserWarningInfoBarDelegate::Create(
InfoBarService::FromWebContents(web_contents()));
}
}
// static
-void ManagedModeNavigationObserver::OnRequestBlocked(
+void SupervisedUserNavigationObserver::OnRequestBlocked(
int render_process_host_id,
int render_view_id,
const GURL& url,
@@ -225,16 +226,17 @@ void ManagedModeNavigationObserver::OnRequestBlocked(
return;
}
- ManagedModeNavigationObserver* navigation_observer =
- ManagedModeNavigationObserver::FromWebContents(web_contents);
+ SupervisedUserNavigationObserver* navigation_observer =
+ SupervisedUserNavigationObserver::FromWebContents(web_contents);
if (navigation_observer)
navigation_observer->OnRequestBlockedInternal(url);
// Show the interstitial.
- ManagedModeInterstitial::Show(web_contents, url, callback);
+ SupervisedUserInterstitial::Show(web_contents, url, callback);
}
-void ManagedModeNavigationObserver::OnRequestBlockedInternal(const GURL& url) {
+void SupervisedUserNavigationObserver::OnRequestBlockedInternal(
+ const GURL& url) {
Time timestamp = Time::Now(); // TODO(bauerb): Use SaneTime when available.
// Create a history entry for the attempt and mark it as such.
history::HistoryAddPageArgs add_page_args(
@@ -257,7 +259,7 @@ void ManagedModeNavigationObserver::OnRequestBlockedInternal(const GURL& url) {
entry->SetVirtualURL(url);
entry->SetTimestamp(timestamp);
blocked_navigations_.push_back(entry.release());
- ManagedUserService* managed_user_service =
- ManagedUserServiceFactory::GetForProfile(profile);
- managed_user_service->DidBlockNavigation(web_contents());
+ SupervisedUserService* supervised_user_service =
+ SupervisedUserServiceFactory::GetForProfile(profile);
+ supervised_user_service->DidBlockNavigation(web_contents());
}

Powered by Google App Engine
This is Rietveld 408576698