Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome/browser/ui/tab_helpers.cc

Issue 462423004: Revert CL 117933003. Re-add resource speculative prefetching code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ui/tab_helpers.h" 5 #include "chrome/browser/ui/tab_helpers.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
10 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
11 #include "chrome/browser/history/history_tab_helper.h" 11 #include "chrome/browser/history/history_tab_helper.h"
12 #include "chrome/browser/infobars/infobar_service.h" 12 #include "chrome/browser/infobars/infobar_service.h"
13 #include "chrome/browser/net/net_error_tab_helper.h" 13 #include "chrome/browser/net/net_error_tab_helper.h"
14 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 14 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
15 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
16 #include "chrome/browser/predictors/resource_prefetch_predictor_tab_helper.h"
15 #include "chrome/browser/prerender/prerender_tab_helper.h" 17 #include "chrome/browser/prerender/prerender_tab_helper.h"
18 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/sessions/session_tab_helper.h" 19 #include "chrome/browser/sessions/session_tab_helper.h"
17 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h" 20 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h"
18 #include "chrome/browser/translate/chrome_translate_client.h" 21 #include "chrome/browser/translate/chrome_translate_client.h"
19 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" 22 #include "chrome/browser/ui/autofill/chrome_autofill_client.h"
20 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" 23 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h"
21 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 24 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
22 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 25 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
23 #include "chrome/browser/ui/navigation_correction_tab_observer.h" 26 #include "chrome/browser/ui/navigation_correction_tab_observer.h"
24 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" 27 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
25 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 28 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
26 #include "chrome/browser/ui/search/search_tab_helper.h" 29 #include "chrome/browser/ui/search/search_tab_helper.h"
27 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 30 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
28 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
29 #include "components/autofill/content/browser/content_autofill_driver.h" 32 #include "components/autofill/content/browser/content_autofill_driver.h"
30 #include "components/autofill/core/browser/autofill_manager.h" 33 #include "components/autofill/core/browser/autofill_manager.h"
31 #include "components/dom_distiller/content/web_contents_main_frame_observer.h" 34 #include "components/dom_distiller/content/web_contents_main_frame_observer.h"
32 #include "components/password_manager/core/browser/password_manager.h" 35 #include "components/password_manager/core/browser/password_manager.h"
33 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
34 37
35 #if defined(OS_ANDROID) 38 #if defined(OS_ANDROID)
36 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" 39 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h"
40 #include "chrome/browser/profiles/profile_android.h"
Lei Zhang 2014/09/09 03:32:20 nit: not used at all?
Zhen Wang 2014/09/13 00:36:33 removed
37 #include "chrome/browser/ui/android/context_menu_helper.h" 41 #include "chrome/browser/ui/android/context_menu_helper.h"
38 #include "chrome/browser/ui/android/window_android_helper.h" 42 #include "chrome/browser/ui/android/window_android_helper.h"
39 #else 43 #else
40 #include "chrome/browser/external_protocol/external_protocol_observer.h" 44 #include "chrome/browser/external_protocol/external_protocol_observer.h"
41 #include "chrome/browser/net/predictor_tab_helper.h" 45 #include "chrome/browser/net/predictor_tab_helper.h"
42 #include "chrome/browser/plugins/plugin_observer.h" 46 #include "chrome/browser/plugins/plugin_observer.h"
43 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" 47 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h"
44 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h" 48 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h"
45 #include "chrome/browser/ui/hung_plugin_tab_helper.h" 49 #include "chrome/browser/ui/hung_plugin_tab_helper.h"
46 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 50 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 108
105 // Mark as adopted. 109 // Mark as adopted.
106 web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey, 110 web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey,
107 new base::SupportsUserData::Data()); 111 new base::SupportsUserData::Data());
108 112
109 #if defined(ENABLE_EXTENSIONS) 113 #if defined(ENABLE_EXTENSIONS)
110 // Set the view type. 114 // Set the view type.
111 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS); 115 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS);
112 #endif 116 #endif
113 117
118 Profile* profile = Profile::FromBrowserContext(
Lei Zhang 2014/09/09 03:32:20 nit: You don't need this, ResourcePrefetchPredicto
Zhen Wang 2014/09/13 00:36:33 Done.
119 web_contents->GetBrowserContext());
120
114 // Create all the tab helpers. 121 // Create all the tab helpers.
115 122
116 // SessionTabHelper comes first because it sets up the tab ID, and other 123 // SessionTabHelper comes first because it sets up the tab ID, and other
117 // helpers may rely on that. 124 // helpers may rely on that.
118 SessionTabHelper::CreateForWebContents(web_contents); 125 SessionTabHelper::CreateForWebContents(web_contents);
119 #if !defined(OS_ANDROID) 126 #if !defined(OS_ANDROID)
120 // ZoomController comes before common tab helpers since ChromeAutofillClient 127 // ZoomController comes before common tab helpers since ChromeAutofillClient
121 // may want to register as a ZoomObserver with it. 128 // may want to register as a ZoomObserver with it.
122 ZoomController::CreateForWebContents(web_contents); 129 ZoomController::CreateForWebContents(web_contents);
123 #endif 130 #endif
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // happens to be already connected. 227 // happens to be already connected.
221 if (OneClickSigninHelper::CanOffer(web_contents, 228 if (OneClickSigninHelper::CanOffer(web_contents,
222 OneClickSigninHelper::CAN_OFFER_FOR_ALL, 229 OneClickSigninHelper::CAN_OFFER_FOR_ALL,
223 std::string(), 230 std::string(),
224 NULL)) { 231 NULL)) {
225 OneClickSigninHelper::CreateForWebContentsWithPasswordManager( 232 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(
226 web_contents, 233 web_contents,
227 ChromePasswordManagerClient::GetManagerFromWebContents(web_contents)); 234 ChromePasswordManagerClient::GetManagerFromWebContents(web_contents));
228 } 235 }
229 #endif 236 #endif
237
238 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile(profile)) {
239 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents(
240 web_contents);
241 }
230 } 242 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698