| 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 if (behavior == ManagedModeURLFilter::ALLOW && | 466 if (behavior == ManagedModeURLFilter::ALLOW && |
| 467 state_ == RECORDING_URLS_AFTER_PREVIEW) { | 467 state_ == RECORDING_URLS_AFTER_PREVIEW) { |
| 468 // The initial page that triggered the interstitial was blocked but the | 468 // The initial page that triggered the interstitial was blocked but the |
| 469 // final page is already in the whitelist so add the series of URLs | 469 // final page is already in the whitelist so add the series of URLs |
| 470 // which lead to the final page to the whitelist as well. | 470 // which lead to the final page to the whitelist as well. |
| 471 AddSavedURLsToWhitelistAndClearState(); | 471 AddSavedURLsToWhitelistAndClearState(); |
| 472 // This page is now allowed so save the index as well. | 472 // This page is now allowed so save the index as well. |
| 473 last_allowed_page_ = web_contents()->GetController().GetCurrentEntryIndex(); | 473 last_allowed_page_ = web_contents()->GetController().GetCurrentEntryIndex(); |
| 474 SimpleAlertInfoBarDelegate::Create( | 474 SimpleAlertInfoBarDelegate::Create( |
| 475 InfoBarService::FromWebContents(web_contents()), | 475 InfoBarService::FromWebContents(web_contents()), |
| 476 NULL, | 476 InfoBarDelegate::kNoIconID, |
| 477 l10n_util::GetStringUTF16(IDS_MANAGED_MODE_ALREADY_ADDED_MESSAGE), | 477 l10n_util::GetStringUTF16(IDS_MANAGED_MODE_ALREADY_ADDED_MESSAGE), |
| 478 true); | 478 true); |
| 479 return; | 479 return; |
| 480 } | 480 } |
| 481 | 481 |
| 482 // Update the exception to the last host visited. A redirect can follow this | 482 // Update the exception to the last host visited. A redirect can follow this |
| 483 // so don't update the state yet. | 483 // so don't update the state yet. |
| 484 if (state_ == RECORDING_URLS_AFTER_PREVIEW) { | 484 if (state_ == RECORDING_URLS_AFTER_PREVIEW) { |
| 485 AddTemporaryException(); | 485 AddTemporaryException(); |
| 486 } | 486 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 HistoryService* history_service = | 581 HistoryService* history_service = |
| 582 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 582 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); |
| 583 | 583 |
| 584 // |history_service| is null if saving history is disabled. | 584 // |history_service| is null if saving history is disabled. |
| 585 if (history_service) | 585 if (history_service) |
| 586 history_service->AddPage(add_page_args); | 586 history_service->AddPage(add_page_args); |
| 587 | 587 |
| 588 // Show the interstitial. | 588 // Show the interstitial. |
| 589 new ManagedModeInterstitial(web_contents, url, callback); | 589 new ManagedModeInterstitial(web_contents, url, callback); |
| 590 } | 590 } |
| OLD | NEW |