| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) |
| 82 history_service->AddPage(add_page_args); | 82 history_service->AddPage(add_page_args); |
| 83 | 83 |
| 84 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); | 84 std::unique_ptr<NavigationEntry> entry(NavigationEntry::Create()); |
| 85 entry->SetVirtualURL(url); | 85 entry->SetVirtualURL(url); |
| 86 entry->SetTimestamp(timestamp); | 86 entry->SetTimestamp(timestamp); |
| 87 scoped_ptr<sessions::SerializedNavigationEntry> serialized_entry( | 87 std::unique_ptr<sessions::SerializedNavigationEntry> serialized_entry( |
| 88 new sessions::SerializedNavigationEntry()); | 88 new sessions::SerializedNavigationEntry()); |
| 89 *serialized_entry = | 89 *serialized_entry = |
| 90 sessions::ContentSerializedNavigationBuilder::FromNavigationEntry( | 90 sessions::ContentSerializedNavigationBuilder::FromNavigationEntry( |
| 91 blocked_navigations_.size(), *entry); | 91 blocked_navigations_.size(), *entry); |
| 92 blocked_navigations_.push_back(serialized_entry.release()); | 92 blocked_navigations_.push_back(serialized_entry.release()); |
| 93 supervised_user_service_->DidBlockNavigation(web_contents_); | 93 supervised_user_service_->DidBlockNavigation(web_contents_); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void SupervisedUserNavigationObserver::OnURLFilterChanged() { | 96 void SupervisedUserNavigationObserver::OnURLFilterChanged() { |
| 97 url_filter_->GetFilteringBehaviorForURLWithAsyncChecks( | 97 url_filter_->GetFilteringBehaviorForURLWithAsyncChecks( |
| (...skipping 10 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 |