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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/infobars/infobar.h" |
12 #include "chrome/browser/infobars/infobar_delegate.h" | 13 #include "chrome/browser/infobars/infobar_delegate.h" |
13 #include "chrome/browser/infobars/infobar_service.h" | 14 #include "chrome/browser/infobars/infobar_service.h" |
14 #include "chrome/browser/managed_mode/managed_user_service.h" | 15 #include "chrome/browser/managed_mode/managed_user_service.h" |
15 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 16 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/interstitial_page.h" | 20 #include "content/public/browser/interstitial_page.h" |
20 #include "content/public/browser/navigation_controller.h" | 21 #include "content/public/browser/navigation_controller.h" |
21 #include "content/public/browser/navigation_details.h" | 22 #include "content/public/browser/navigation_details.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 DCHECK(details.is_navigation_to_different_page()); | 61 DCHECK(details.is_navigation_to_different_page()); |
61 const content::NavigationController& controller = | 62 const content::NavigationController& controller = |
62 web_contents->GetController(); | 63 web_contents->GetController(); |
63 details.entry = controller.GetActiveEntry(); | 64 details.entry = controller.GetActiveEntry(); |
64 if (controller.GetLastCommittedEntry()) { | 65 if (controller.GetLastCommittedEntry()) { |
65 details.previous_entry_index = controller.GetLastCommittedEntryIndex(); | 66 details.previous_entry_index = controller.GetLastCommittedEntryIndex(); |
66 details.previous_url = controller.GetLastCommittedEntry()->GetURL(); | 67 details.previous_url = controller.GetLastCommittedEntry()->GetURL(); |
67 } | 68 } |
68 details.type = content::NAVIGATION_TYPE_NEW_PAGE; | 69 details.type = content::NAVIGATION_TYPE_NEW_PAGE; |
69 for (int i = service->infobar_count() - 1; i >= 0; --i) { | 70 for (int i = service->infobar_count() - 1; i >= 0; --i) { |
70 if (service->infobar_at(i)->ShouldExpire(details)) | 71 if (service->infobar_at(i)->delegate()->ShouldExpire(details)) |
71 service->RemoveInfoBar(service->infobar_at(i)); | 72 service->RemoveInfoBar(service->infobar_at(i)); |
72 } | 73 } |
73 } | 74 } |
74 | 75 |
75 // TODO(bauerb): Extract an observer callback on ManagedUserService for this. | 76 // TODO(bauerb): Extract an observer callback on ManagedUserService for this. |
76 Profile* profile = | 77 Profile* profile = |
77 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 78 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
78 PrefService* prefs = profile->GetPrefs(); | 79 PrefService* prefs = profile->GetPrefs(); |
79 pref_change_registrar_.Init(prefs); | 80 pref_change_registrar_.Init(prefs); |
80 pref_change_registrar_.Add( | 81 pref_change_registrar_.Add( |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 200 |
200 void ManagedModeInterstitial::OnFilteringPrefsChanged() { | 201 void ManagedModeInterstitial::OnFilteringPrefsChanged() { |
201 if (ShouldProceed()) | 202 if (ShouldProceed()) |
202 interstitial_page_->Proceed(); | 203 interstitial_page_->Proceed(); |
203 } | 204 } |
204 | 205 |
205 void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) { | 206 void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) { |
206 BrowserThread::PostTask( | 207 BrowserThread::PostTask( |
207 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); | 208 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); |
208 } | 209 } |
OLD | NEW |