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

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

Issue 1459793002: Android: Allow compiling browser without Java UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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
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/chrome_content_settings_client.h" 9 #include "chrome/browser/content_settings/chrome_content_settings_client.h"
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" 32 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h"
33 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 33 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
34 #include "chrome/browser/ui/navigation_correction_tab_observer.h" 34 #include "chrome/browser/ui/navigation_correction_tab_observer.h"
35 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 35 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
36 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" 36 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
37 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 37 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
38 #include "chrome/browser/ui/search/search_tab_helper.h" 38 #include "chrome/browser/ui/search/search_tab_helper.h"
39 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 39 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
40 #include "chrome/browser/ui/tab_dialogs.h" 40 #include "chrome/browser/ui/tab_dialogs.h"
41 #include "chrome/common/chrome_switches.h" 41 #include "chrome/common/chrome_switches.h"
42 #include "chrome/common/features.h"
42 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 43 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
43 #include "components/autofill/core/browser/autofill_manager.h" 44 #include "components/autofill/core/browser/autofill_manager.h"
44 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser ver.h" 45 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser ver.h"
45 #include "components/dom_distiller/core/dom_distiller_switches.h" 46 #include "components/dom_distiller/core/dom_distiller_switches.h"
46 #include "components/history/content/browser/web_contents_top_sites_observer.h" 47 #include "components/history/content/browser/web_contents_top_sites_observer.h"
47 #include "components/history/core/browser/top_sites.h" 48 #include "components/history/core/browser/top_sites.h"
48 #include "components/password_manager/core/browser/password_manager.h" 49 #include "components/password_manager/core/browser/password_manager.h"
49 #include "components/tracing/tracing_switches.h" 50 #include "components/tracing/tracing_switches.h"
50 #include "content/public/browser/web_contents.h" 51 #include "content/public/browser/web_contents.h"
51 52
52 #if defined(OS_ANDROID) 53 #if BUILDFLAG(ANDROID_JAVA_UI)
53 #include "chrome/browser/android/data_usage/data_use_tab_helper.h" 54 #include "chrome/browser/android/data_usage/data_use_tab_helper.h"
54 #include "chrome/browser/android/voice_search_tab_helper.h" 55 #include "chrome/browser/android/voice_search_tab_helper.h"
55 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" 56 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h"
56 #include "chrome/browser/ui/android/context_menu_helper.h" 57 #include "chrome/browser/ui/android/context_menu_helper.h"
57 #include "chrome/browser/ui/android/window_android_helper.h" 58 #include "chrome/browser/ui/android/window_android_helper.h"
58 #else 59 #else
59 #include "chrome/browser/banners/app_banner_manager_desktop.h" 60 #include "chrome/browser/banners/app_banner_manager_desktop.h"
60 #include "chrome/browser/plugins/plugin_observer.h" 61 #include "chrome/browser/plugins/plugin_observer.h"
61 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" 62 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h"
62 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h" 63 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h"
63 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 64 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
64 #include "chrome/browser/ui/hung_plugin_tab_helper.h" 65 #include "chrome/browser/ui/hung_plugin_tab_helper.h"
65 #include "chrome/browser/ui/sad_tab_helper.h" 66 #include "chrome/browser/ui/sad_tab_helper.h"
66 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 67 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
67 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" 68 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
68 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 69 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
69 #include "components/pdf/browser/pdf_web_contents_helper.h" 70 #include "components/pdf/browser/pdf_web_contents_helper.h"
70 #include "components/ui/zoom/zoom_controller.h" 71 #include "components/ui/zoom/zoom_controller.h"
71 #include "components/web_modal/web_contents_modal_dialog_manager.h" 72 #include "components/web_modal/web_contents_modal_dialog_manager.h"
72 #endif // defined(OS_ANDROID) 73 #endif // BUILDFLAG(ANDROID_JAVA_UI)
73 74
74 #if defined(OS_WIN) 75 #if defined(OS_WIN)
75 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" 76 #include "chrome/browser/ui/metro_pin_tab_helper_win.h"
76 #endif 77 #endif
77 78
78 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 79 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
79 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" 80 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
80 #endif 81 #endif
81 82
82 #if defined(ENABLE_EXTENSIONS) 83 #if defined(ENABLE_EXTENSIONS)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 #if defined(ENABLE_EXTENSIONS) 125 #if defined(ENABLE_EXTENSIONS)
125 // Set the view type. 126 // Set the view type.
126 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS); 127 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS);
127 #endif 128 #endif
128 129
129 // Create all the tab helpers. 130 // Create all the tab helpers.
130 131
131 // SessionTabHelper comes first because it sets up the tab ID, and other 132 // SessionTabHelper comes first because it sets up the tab ID, and other
132 // helpers may rely on that. 133 // helpers may rely on that.
133 SessionTabHelper::CreateForWebContents(web_contents); 134 SessionTabHelper::CreateForWebContents(web_contents);
134 #if !defined(OS_ANDROID) 135 #if !BUILDFLAG(ANDROID_JAVA_UI)
135 // ZoomController comes before common tab helpers since ChromeAutofillClient 136 // ZoomController comes before common tab helpers since ChromeAutofillClient
136 // may want to register as a ZoomObserver with it. 137 // may want to register as a ZoomObserver with it.
137 ui_zoom::ZoomController::CreateForWebContents(web_contents); 138 ui_zoom::ZoomController::CreateForWebContents(web_contents);
138 #endif 139 #endif
139 140
140 // --- Common tab helpers --- 141 // --- Common tab helpers ---
141 142
142 autofill::ChromeAutofillClient::CreateForWebContents(web_contents); 143 autofill::ChromeAutofillClient::CreateForWebContents(web_contents);
143 autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( 144 autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate(
144 web_contents, 145 web_contents,
(...skipping 27 matching lines...) Expand all
172 SearchTabHelper::CreateForWebContents(web_contents); 173 SearchTabHelper::CreateForWebContents(web_contents);
173 ChromeSecurityStateModelClient::CreateForWebContents(web_contents); 174 ChromeSecurityStateModelClient::CreateForWebContents(web_contents);
174 if (SiteEngagementService::IsEnabled()) 175 if (SiteEngagementService::IsEnabled())
175 SiteEngagementHelper::CreateForWebContents(web_contents); 176 SiteEngagementHelper::CreateForWebContents(web_contents);
176 // TODO(vabr): Remove TabSpecificContentSettings from here once their function 177 // TODO(vabr): Remove TabSpecificContentSettings from here once their function
177 // is taken over by ChromeContentSettingsClient. http://crbug.com/387075 178 // is taken over by ChromeContentSettingsClient. http://crbug.com/387075
178 TabSpecificContentSettings::CreateForWebContents(web_contents); 179 TabSpecificContentSettings::CreateForWebContents(web_contents);
179 180
180 // --- Platform-specific tab helpers --- 181 // --- Platform-specific tab helpers ---
181 182
182 #if defined(OS_ANDROID) 183 #if BUILDFLAG(ANDROID_JAVA_UI)
183 ContextMenuHelper::CreateForWebContents(web_contents); 184 ContextMenuHelper::CreateForWebContents(web_contents);
184 DataUseTabHelper::CreateForWebContents(web_contents); 185 DataUseTabHelper::CreateForWebContents(web_contents);
185 SingleTabModeTabHelper::CreateForWebContents(web_contents); 186 SingleTabModeTabHelper::CreateForWebContents(web_contents);
186 VoiceSearchTabHelper::CreateForWebContents(web_contents); 187 VoiceSearchTabHelper::CreateForWebContents(web_contents);
187 WindowAndroidHelper::CreateForWebContents(web_contents); 188 WindowAndroidHelper::CreateForWebContents(web_contents);
188 #else 189 #else
189 BookmarkTabHelper::CreateForWebContents(web_contents); 190 BookmarkTabHelper::CreateForWebContents(web_contents);
190 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( 191 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
191 web_contents); 192 web_contents);
192 extensions::WebNavigationTabObserver::CreateForWebContents(web_contents); 193 extensions::WebNavigationTabObserver::CreateForWebContents(web_contents);
(...skipping 28 matching lines...) Expand all
221 #endif 222 #endif
222 223
223 #if defined(ENABLE_EXTENSIONS) 224 #if defined(ENABLE_EXTENSIONS)
224 extensions::TabHelper::CreateForWebContents(web_contents); 225 extensions::TabHelper::CreateForWebContents(web_contents);
225 #endif 226 #endif
226 227
227 #if defined(ENABLE_SUPERVISED_USERS) 228 #if defined(ENABLE_SUPERVISED_USERS)
228 SupervisedUserNavigationObserver::CreateForWebContents(web_contents); 229 SupervisedUserNavigationObserver::CreateForWebContents(web_contents);
229 #endif 230 #endif
230 231
231 #if defined(ENABLE_PRINTING) && !defined(OS_ANDROID) 232 #if defined(ENABLE_PRINTING) && !BUILDFLAG(ANDROID_JAVA_UI)
232 #if defined(ENABLE_PRINT_PREVIEW) 233 #if defined(ENABLE_PRINT_PREVIEW)
233 printing::PrintViewManager::CreateForWebContents(web_contents); 234 printing::PrintViewManager::CreateForWebContents(web_contents);
234 printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents); 235 printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents);
235 #else 236 #else
236 printing::PrintViewManagerBasic::CreateForWebContents(web_contents); 237 printing::PrintViewManagerBasic::CreateForWebContents(web_contents);
237 #endif // defined(ENABLE_PRINT_PREVIEW) 238 #endif // defined(ENABLE_PRINT_PREVIEW)
238 #endif // defined(ENABLE_PRINTING) && !defined(OS_ANDROID) 239 #endif // defined(ENABLE_PRINTING) && !BUILDFLAG(ANDROID_JAVA_UI)
239 240
240 bool enabled_distiller = base::CommandLine::ForCurrentProcess()->HasSwitch( 241 bool enabled_distiller = base::CommandLine::ForCurrentProcess()->HasSwitch(
241 switches::kEnableDomDistiller); 242 switches::kEnableDomDistiller);
242 #if defined(ENABLE_PRINT_PREVIEW) 243 #if defined(ENABLE_PRINT_PREVIEW)
243 if (PrintPreviewDistiller::IsEnabled()) 244 if (PrintPreviewDistiller::IsEnabled())
244 enabled_distiller = true; 245 enabled_distiller = true;
245 #endif // defined(ENABLE_PRINT_PREVIEW) 246 #endif // defined(ENABLE_PRINT_PREVIEW)
246 247
247 if (enabled_distiller) { 248 if (enabled_distiller) {
248 dom_distiller::WebContentsMainFrameObserver::CreateForWebContents( 249 dom_distiller::WebContentsMainFrameObserver::CreateForWebContents(
249 web_contents); 250 web_contents);
250 } 251 }
251 252
252 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( 253 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile(
253 web_contents->GetBrowserContext())) { 254 web_contents->GetBrowserContext())) {
254 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( 255 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents(
255 web_contents); 256 web_contents);
256 } 257 }
257 258
258 if (tracing::NavigationTracingObserver::IsEnabled()) 259 if (tracing::NavigationTracingObserver::IsEnabled())
259 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); 260 tracing::NavigationTracingObserver::CreateForWebContents(web_contents);
260 } 261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698