| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/supervised_user_navigation_observer.h" | 5 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 void SupervisedUserNavigationObserver::OnRequestBlockedInternal( | 87 void SupervisedUserNavigationObserver::OnRequestBlockedInternal( |
| 88 const GURL& url, | 88 const GURL& url, |
| 89 supervised_user_error_page::FilteringBehaviorReason reason, | 89 supervised_user_error_page::FilteringBehaviorReason reason, |
| 90 const base::Callback<void(bool)>& callback) { | 90 const base::Callback<void(bool)>& callback) { |
| 91 Time timestamp = Time::Now(); // TODO(bauerb): Use SaneTime when available. | 91 Time timestamp = Time::Now(); // TODO(bauerb): Use SaneTime when available. |
| 92 // Create a history entry for the attempt and mark it as such. | 92 // Create a history entry for the attempt and mark it as such. |
| 93 history::HistoryAddPageArgs add_page_args( | 93 history::HistoryAddPageArgs add_page_args( |
| 94 url, timestamp, history::ContextIDForWebContents(web_contents()), 0, url, | 94 url, timestamp, history::ContextIDForWebContents(web_contents()), 0, url, |
| 95 history::RedirectList(), ui::PAGE_TRANSITION_BLOCKED, | 95 history::RedirectList(), ui::PAGE_TRANSITION_BLOCKED, |
| 96 history::SOURCE_BROWSED, false, true); | 96 history::SOURCE_BROWSED, base::nullopt, true); |
| 97 | 97 |
| 98 // Add the entry to the history database. | 98 // Add the entry to the history database. |
| 99 Profile* profile = | 99 Profile* profile = |
| 100 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 100 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 101 history::HistoryService* history_service = | 101 history::HistoryService* history_service = |
| 102 HistoryServiceFactory::GetForProfile(profile, | 102 HistoryServiceFactory::GetForProfile(profile, |
| 103 ServiceAccessType::IMPLICIT_ACCESS); | 103 ServiceAccessType::IMPLICIT_ACCESS); |
| 104 | 104 |
| 105 // |history_service| is null if saving history is disabled. | 105 // |history_service| is null if saving history is disabled. |
| 106 if (history_service) | 106 if (history_service) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 initial_page_load, wrapped_callback); | 152 initial_page_load, wrapped_callback); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void SupervisedUserNavigationObserver::OnInterstitialResult( | 155 void SupervisedUserNavigationObserver::OnInterstitialResult( |
| 156 const base::Callback<void(bool)>& callback, | 156 const base::Callback<void(bool)>& callback, |
| 157 bool result) { | 157 bool result) { |
| 158 is_showing_interstitial_ = false; | 158 is_showing_interstitial_ = false; |
| 159 if (callback) | 159 if (callback) |
| 160 callback.Run(result); | 160 callback.Run(result); |
| 161 } | 161 } |
| OLD | NEW |