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/prerender/prerender_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "content/public/browser/render_process_host.h" | 52 #include "content/public/browser/render_process_host.h" |
53 #include "content/public/browser/render_view_host.h" | 53 #include "content/public/browser/render_view_host.h" |
54 #include "content/public/browser/session_storage_namespace.h" | 54 #include "content/public/browser/session_storage_namespace.h" |
55 #include "content/public/browser/web_contents.h" | 55 #include "content/public/browser/web_contents.h" |
56 #include "content/public/browser/web_contents_delegate.h" | 56 #include "content/public/browser/web_contents_delegate.h" |
57 #include "content/public/browser/web_contents_view.h" | 57 #include "content/public/browser/web_contents_view.h" |
58 #include "content/public/common/favicon_url.h" | 58 #include "content/public/common/favicon_url.h" |
59 #include "net/url_request/url_request_context.h" | 59 #include "net/url_request/url_request_context.h" |
60 #include "net/url_request/url_request_context_getter.h" | 60 #include "net/url_request/url_request_context_getter.h" |
61 | 61 |
| 62 #if defined(ENABLE_MANAGED_USERS) |
| 63 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" |
| 64 #include "chrome/browser/managed_mode/managed_user_service.h" |
| 65 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
| 66 #endif |
| 67 |
62 using content::BrowserThread; | 68 using content::BrowserThread; |
63 using content::RenderViewHost; | 69 using content::RenderViewHost; |
64 using content::SessionStorageNamespace; | 70 using content::SessionStorageNamespace; |
65 using content::WebContents; | 71 using content::WebContents; |
66 using predictors::LoggedInPredictorTable; | 72 using predictors::LoggedInPredictorTable; |
67 | 73 |
68 namespace prerender { | 74 namespace prerender { |
69 | 75 |
70 namespace { | 76 namespace { |
71 | 77 |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 int process_id, | 1049 int process_id, |
1044 const GURL& url_arg, | 1050 const GURL& url_arg, |
1045 const content::Referrer& referrer, | 1051 const content::Referrer& referrer, |
1046 const gfx::Size& size, | 1052 const gfx::Size& size, |
1047 SessionStorageNamespace* session_storage_namespace) { | 1053 SessionStorageNamespace* session_storage_namespace) { |
1048 DCHECK(CalledOnValidThread()); | 1054 DCHECK(CalledOnValidThread()); |
1049 | 1055 |
1050 if (!IsEnabled()) | 1056 if (!IsEnabled()) |
1051 return NULL; | 1057 return NULL; |
1052 | 1058 |
| 1059 #if defined(ENABLE_MANAGED_USERS) |
| 1060 // Check if the url would be blocked. If yes, don't add the prerender. |
| 1061 ManagedUserService* service = |
| 1062 ManagedUserServiceFactory::GetForProfile(profile_); |
| 1063 if (service->ProfileIsManaged()) { |
| 1064 ManagedModeURLFilter* filter = service->GetURLFilterForUIThread(); |
| 1065 if (filter->GetFilteringBehaviorForURL(url_arg) == |
| 1066 ManagedModeURLFilter::BLOCK) |
| 1067 return NULL; |
| 1068 } |
| 1069 #endif |
| 1070 |
1053 if ((origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN || | 1071 if ((origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN || |
1054 origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) && | 1072 origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) && |
1055 IsGoogleSearchResultURL(referrer.url)) { | 1073 IsGoogleSearchResultURL(referrer.url)) { |
1056 origin = ORIGIN_GWS_PRERENDER; | 1074 origin = ORIGIN_GWS_PRERENDER; |
1057 } | 1075 } |
1058 | 1076 |
1059 GURL url = url_arg; | 1077 GURL url = url_arg; |
1060 GURL alias_url; | 1078 GURL alias_url; |
1061 uint8 experiment = GetQueryStringBasedExperiment(url_arg); | 1079 uint8 experiment = GetQueryStringBasedExperiment(url_arg); |
1062 if (IsControlGroup(experiment) && | 1080 if (IsControlGroup(experiment) && |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 logged_in_state_->erase(domain_key); | 1525 logged_in_state_->erase(domain_key); |
1508 } | 1526 } |
1509 | 1527 |
1510 void PrerenderManager::LoggedInPredictorDataReceived( | 1528 void PrerenderManager::LoggedInPredictorDataReceived( |
1511 scoped_ptr<LoggedInStateMap> new_map) { | 1529 scoped_ptr<LoggedInStateMap> new_map) { |
1512 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1530 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1513 logged_in_state_.swap(new_map); | 1531 logged_in_state_.swap(new_map); |
1514 } | 1532 } |
1515 | 1533 |
1516 } // namespace prerender | 1534 } // namespace prerender |
OLD | NEW |