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 "chrome/browser/history/history_service_factory.h" | 9 #include "chrome/browser/history/history_service_factory.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 SupervisedUserInterstitial::Show(web_contents, url, reason, callback); | 61 SupervisedUserInterstitial::Show(web_contents, url, reason, callback); |
62 } | 62 } |
63 | 63 |
64 void SupervisedUserNavigationObserver::OnRequestBlockedInternal( | 64 void SupervisedUserNavigationObserver::OnRequestBlockedInternal( |
65 const GURL& url) { | 65 const GURL& url) { |
66 Time timestamp = Time::Now(); // TODO(bauerb): Use SaneTime when available. | 66 Time timestamp = Time::Now(); // TODO(bauerb): Use SaneTime when available. |
67 // Create a history entry for the attempt and mark it as such. | 67 // Create a history entry for the attempt and mark it as such. |
68 history::HistoryAddPageArgs add_page_args( | 68 history::HistoryAddPageArgs add_page_args( |
69 url, timestamp, history::ContextIDForWebContents(web_contents_), 0, url, | 69 url, timestamp, history::ContextIDForWebContents(web_contents_), 0, url, |
70 history::RedirectList(), ui::PAGE_TRANSITION_BLOCKED, | 70 history::RedirectList(), ui::PAGE_TRANSITION_BLOCKED, |
71 history::SOURCE_BROWSED, false); | 71 history::SOURCE_BROWSED, false, true); |
72 | 72 |
73 // Add the entry to the history database. | 73 // Add the entry to the history database. |
74 Profile* profile = | 74 Profile* profile = |
75 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 75 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
76 history::HistoryService* history_service = | 76 history::HistoryService* history_service = |
77 HistoryServiceFactory::GetForProfile(profile, | 77 HistoryServiceFactory::GetForProfile(profile, |
78 ServiceAccessType::IMPLICIT_ACCESS); | 78 ServiceAccessType::IMPLICIT_ACCESS); |
79 | 79 |
80 // |history_service| is null if saving history is disabled. | 80 // |history_service| is null if saving history is disabled. |
81 if (history_service) | 81 if (history_service) |
(...skipping 26 matching lines...) Expand all Loading... |
108 bool uncertain) { | 108 bool uncertain) { |
109 // If the page has been changed in the meantime, we can exit. | 109 // If the page has been changed in the meantime, we can exit. |
110 if (url != web_contents_->GetLastCommittedURL()) | 110 if (url != web_contents_->GetLastCommittedURL()) |
111 return; | 111 return; |
112 | 112 |
113 if (behavior == SupervisedUserURLFilter::FilteringBehavior::BLOCK) { | 113 if (behavior == SupervisedUserURLFilter::FilteringBehavior::BLOCK) { |
114 SupervisedUserInterstitial::Show(web_contents_, url, reason, | 114 SupervisedUserInterstitial::Show(web_contents_, url, reason, |
115 base::Callback<void(bool)>()); | 115 base::Callback<void(bool)>()); |
116 } | 116 } |
117 } | 117 } |
OLD | NEW |