OLD | NEW |
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/managed_mode/managed_mode_interstitial.h" | 5 #include "chrome/browser/managed_mode/managed_mode_interstitial.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 service->RemoveInfoBar(infobar); | 91 service->RemoveInfoBar(infobar); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 // TODO(bauerb): Extract an observer callback on ManagedUserService for this. | 95 // TODO(bauerb): Extract an observer callback on ManagedUserService for this. |
96 Profile* profile = | 96 Profile* profile = |
97 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 97 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
98 PrefService* prefs = profile->GetPrefs(); | 98 PrefService* prefs = profile->GetPrefs(); |
99 pref_change_registrar_.Init(prefs); | 99 pref_change_registrar_.Init(prefs); |
100 pref_change_registrar_.Add( | 100 pref_change_registrar_.Add( |
101 prefs::kDefaultManagedModeFilteringBehavior, | 101 prefs::kDefaultSupervisedUserFilteringBehavior, |
102 base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged, | 102 base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged, |
103 base::Unretained(this))); | 103 base::Unretained(this))); |
104 pref_change_registrar_.Add( | 104 pref_change_registrar_.Add( |
105 prefs::kManagedModeManualHosts, | 105 prefs::kSupervisedUserManualHosts, |
106 base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged, | 106 base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged, |
107 base::Unretained(this))); | 107 base::Unretained(this))); |
108 pref_change_registrar_.Add( | 108 pref_change_registrar_.Add( |
109 prefs::kManagedModeManualURLs, | 109 prefs::kSupervisedUserManualURLs, |
110 base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged, | 110 base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged, |
111 base::Unretained(this))); | 111 base::Unretained(this))); |
112 | 112 |
113 languages_ = prefs->GetString(prefs::kAcceptLanguages); | 113 languages_ = prefs->GetString(prefs::kAcceptLanguages); |
114 interstitial_page_ = | 114 interstitial_page_ = |
115 content::InterstitialPage::Create(web_contents_, true, url_, this); | 115 content::InterstitialPage::Create(web_contents_, true, url_, this); |
116 interstitial_page_->Show(); | 116 interstitial_page_->Show(); |
117 | 117 |
118 return true; | 118 return true; |
119 } | 119 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) { | 226 void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) { |
227 // If there is no history entry to go back to, close the tab instead. | 227 // If there is no history entry to go back to, close the tab instead. |
228 int nav_entry_count = web_contents_->GetController().GetEntryCount(); | 228 int nav_entry_count = web_contents_->GetController().GetEntryCount(); |
229 if (!continue_request && nav_entry_count == 0) | 229 if (!continue_request && nav_entry_count == 0) |
230 web_contents_->Close(); | 230 web_contents_->Close(); |
231 | 231 |
232 BrowserThread::PostTask( | 232 BrowserThread::PostTask( |
233 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); | 233 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); |
234 } | 234 } |
OLD | NEW |