| 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_navigation_observer.h" | 5 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 DVLOG(1) << "NavigateToPendingEntry " << url.spec(); | 392 DVLOG(1) << "NavigateToPendingEntry " << url.spec(); |
| 393 // This method gets called only when the user goes back and forward and when | 393 // This method gets called only when the user goes back and forward and when |
| 394 // the user types a new URL. So do the main work in | 394 // the user types a new URL. So do the main work in |
| 395 // ProvisionalChangeToMainFrameUrl and only check that the user didn't go | 395 // ProvisionalChangeToMainFrameUrl and only check that the user didn't go |
| 396 // back to a blocked site here. | 396 // back to a blocked site here. |
| 397 ManagedModeURLFilter::FilteringBehavior behavior = | 397 ManagedModeURLFilter::FilteringBehavior behavior = |
| 398 url_filter_->GetFilteringBehaviorForURL(url); | 398 url_filter_->GetFilteringBehaviorForURL(url); |
| 399 int current_index = web_contents()->GetController().GetCurrentEntryIndex(); | 399 int current_index = web_contents()->GetController().GetCurrentEntryIndex(); |
| 400 // First check that the user didn't go back to a blocked page, then check | 400 // First check that the user didn't go back to a blocked page, then check |
| 401 // that the navigation is allowed. | 401 // that the navigation is allowed. |
| 402 if (last_allowed_page_ < 0 || current_index <= last_allowed_page_ || | 402 if (current_index <= last_allowed_page_ || |
| 403 (behavior == ManagedModeURLFilter::BLOCK && | 403 (behavior == ManagedModeURLFilter::BLOCK && |
| 404 !CanTemporarilyNavigateHost(url))) { | 404 !CanTemporarilyNavigateHost(url))) { |
| 405 ClearObserverState(); | 405 ClearObserverState(); |
| 406 } | 406 } |
| 407 finished_redirects_ = false; | 407 finished_redirects_ = false; |
| 408 } | 408 } |
| 409 | 409 |
| 410 void ManagedModeNavigationObserver::DidNavigateMainFrame( | 410 void ManagedModeNavigationObserver::DidNavigateMainFrame( |
| 411 const content::LoadCommittedDetails& details, | 411 const content::LoadCommittedDetails& details, |
| 412 const content::FrameNavigateParams& params) { | 412 const content::FrameNavigateParams& params) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 518 |
| 519 if (behavior == ManagedModeURLFilter::BLOCK) { | 519 if (behavior == ManagedModeURLFilter::BLOCK) { |
| 520 DCHECK_EQ(RECORDING_URLS_AFTER_PREVIEW, state_); | 520 DCHECK_EQ(RECORDING_URLS_AFTER_PREVIEW, state_); |
| 521 // Add the infobar. | 521 // Add the infobar. |
| 522 if (!preview_infobar_delegate_) { | 522 if (!preview_infobar_delegate_) { |
| 523 preview_infobar_delegate_ = ManagedModePreviewInfobarDelegate::Create( | 523 preview_infobar_delegate_ = ManagedModePreviewInfobarDelegate::Create( |
| 524 InfoBarService::FromWebContents(web_contents())); | 524 InfoBarService::FromWebContents(web_contents())); |
| 525 } | 525 } |
| 526 } | 526 } |
| 527 } | 527 } |
| OLD | NEW |