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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Create a history entry for the attempt and mark it as such. | 228 // Create a history entry for the attempt and mark it as such. |
229 history::HistoryAddPageArgs add_page_args( | 229 history::HistoryAddPageArgs add_page_args( |
230 url, timestamp, web_contents(), 0, | 230 url, timestamp, web_contents(), 0, |
231 url, history::RedirectList(), | 231 url, history::RedirectList(), |
232 ui::PAGE_TRANSITION_BLOCKED, history::SOURCE_BROWSED, | 232 ui::PAGE_TRANSITION_BLOCKED, history::SOURCE_BROWSED, |
233 false); | 233 false); |
234 | 234 |
235 // Add the entry to the history database. | 235 // Add the entry to the history database. |
236 Profile* profile = | 236 Profile* profile = |
237 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 237 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
238 HistoryService* history_service = | 238 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
239 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 239 profile, ServiceAccessType::IMPLICIT_ACCESS); |
240 | 240 |
241 // |history_service| is null if saving history is disabled. | 241 // |history_service| is null if saving history is disabled. |
242 if (history_service) | 242 if (history_service) |
243 history_service->AddPage(add_page_args); | 243 history_service->AddPage(add_page_args); |
244 | 244 |
245 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); | 245 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); |
246 entry->SetVirtualURL(url); | 246 entry->SetVirtualURL(url); |
247 entry->SetTimestamp(timestamp); | 247 entry->SetTimestamp(timestamp); |
248 blocked_navigations_.push_back(entry.release()); | 248 blocked_navigations_.push_back(entry.release()); |
249 SupervisedUserService* supervised_user_service = | 249 SupervisedUserService* supervised_user_service = |
250 SupervisedUserServiceFactory::GetForProfile(profile); | 250 SupervisedUserServiceFactory::GetForProfile(profile); |
251 supervised_user_service->DidBlockNavigation(web_contents()); | 251 supervised_user_service->DidBlockNavigation(web_contents()); |
252 } | 252 } |
OLD | NEW |