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 | |
68 using content::BrowserThread; | 62 using content::BrowserThread; |
69 using content::RenderViewHost; | 63 using content::RenderViewHost; |
70 using content::SessionStorageNamespace; | 64 using content::SessionStorageNamespace; |
71 using content::WebContents; | 65 using content::WebContents; |
72 using predictors::LoggedInPredictorTable; | 66 using predictors::LoggedInPredictorTable; |
73 | 67 |
74 namespace prerender { | 68 namespace prerender { |
75 | 69 |
76 namespace { | 70 namespace { |
77 | 71 |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 int process_id, | 1051 int process_id, |
1058 const GURL& url_arg, | 1052 const GURL& url_arg, |
1059 const content::Referrer& referrer, | 1053 const content::Referrer& referrer, |
1060 const gfx::Size& size, | 1054 const gfx::Size& size, |
1061 SessionStorageNamespace* session_storage_namespace) { | 1055 SessionStorageNamespace* session_storage_namespace) { |
1062 DCHECK(CalledOnValidThread()); | 1056 DCHECK(CalledOnValidThread()); |
1063 | 1057 |
1064 if (!IsEnabled()) | 1058 if (!IsEnabled()) |
1065 return NULL; | 1059 return NULL; |
1066 | 1060 |
1067 #if defined(ENABLE_MANAGED_USERS) | |
1068 // Check if the url would be blocked. If yes, don't add the prerender. | |
1069 ManagedUserService* service = | |
1070 ManagedUserServiceFactory::GetForProfile(profile_); | |
1071 if (service->ProfileIsManaged()) { | |
1072 ManagedModeURLFilter* filter = service->GetURLFilterForUIThread(); | |
1073 if (filter->GetFilteringBehaviorForURL(url_arg) == | |
1074 ManagedModeURLFilter::BLOCK) | |
1075 return NULL; | |
1076 } | |
1077 #endif | |
1078 | |
1079 if ((origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN || | 1061 if ((origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN || |
1080 origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) && | 1062 origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) && |
1081 IsGoogleSearchResultURL(referrer.url)) { | 1063 IsGoogleSearchResultURL(referrer.url)) { |
1082 origin = ORIGIN_GWS_PRERENDER; | 1064 origin = ORIGIN_GWS_PRERENDER; |
1083 } | 1065 } |
1084 | 1066 |
1085 GURL url = url_arg; | 1067 GURL url = url_arg; |
1086 GURL alias_url; | 1068 GURL alias_url; |
1087 uint8 experiment = GetQueryStringBasedExperiment(url_arg); | 1069 uint8 experiment = GetQueryStringBasedExperiment(url_arg); |
1088 if (IsControlGroup(experiment) && | 1070 if (IsControlGroup(experiment) && |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 logged_in_state_->erase(domain_key); | 1519 logged_in_state_->erase(domain_key); |
1538 } | 1520 } |
1539 | 1521 |
1540 void PrerenderManager::LoggedInPredictorDataReceived( | 1522 void PrerenderManager::LoggedInPredictorDataReceived( |
1541 scoped_ptr<LoggedInStateMap> new_map) { | 1523 scoped_ptr<LoggedInStateMap> new_map) { |
1542 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1524 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1543 logged_in_state_.swap(new_map); | 1525 logged_in_state_.swap(new_map); |
1544 } | 1526 } |
1545 | 1527 |
1546 } // namespace prerender | 1528 } // namespace prerender |
OLD | NEW |