OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_contents/tab_contents_wrapper.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 | 8 |
| 9 #include "base/command_line.h" |
9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
10 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
11 #include "chrome/browser/autocomplete_history_manager.h" | 12 #include "chrome/browser/autocomplete_history_manager.h" |
| 13 #include "chrome/browser/autofill/autofill_external_delegate.h" |
12 #include "chrome/browser/autofill/autofill_manager.h" | 14 #include "chrome/browser/autofill/autofill_manager.h" |
13 #include "chrome/browser/automation/automation_tab_helper.h" | 15 #include "chrome/browser/automation/automation_tab_helper.h" |
14 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 17 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
16 #include "chrome/browser/download/download_request_limiter_observer.h" | 18 #include "chrome/browser/download/download_request_limiter_observer.h" |
17 #include "chrome/browser/extensions/extension_tab_helper.h" | 19 #include "chrome/browser/extensions/extension_tab_helper.h" |
18 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 20 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
19 #include "chrome/browser/external_protocol/external_protocol_observer.h" | 21 #include "chrome/browser/external_protocol/external_protocol_observer.h" |
20 #include "chrome/browser/favicon/favicon_tab_helper.h" | 22 #include "chrome/browser/favicon/favicon_tab_helper.h" |
21 #include "chrome/browser/google/google_util.h" | 23 #include "chrome/browser/google/google_util.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 tab_contents_(contents) { | 241 tab_contents_(contents) { |
240 DCHECK(contents); | 242 DCHECK(contents); |
241 DCHECK(!GetCurrentWrapperForContents(contents)); | 243 DCHECK(!GetCurrentWrapperForContents(contents)); |
242 // Stash this in the property bag so it can be retrieved without having to | 244 // Stash this in the property bag so it can be retrieved without having to |
243 // go to a Browser. | 245 // go to a Browser. |
244 property_accessor()->SetProperty(contents->property_bag(), this); | 246 property_accessor()->SetProperty(contents->property_bag(), this); |
245 | 247 |
246 // Create the tab helpers. | 248 // Create the tab helpers. |
247 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents)); | 249 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents)); |
248 autofill_manager_.reset(new AutofillManager(this)); | 250 autofill_manager_.reset(new AutofillManager(this)); |
| 251 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 252 switches::kExternalAutofillPopup)) { |
| 253 autofill_external_delegate_.reset( |
| 254 AutofillExternalDelegate::Create(this, autofill_manager_.get())); |
| 255 autofill_manager_->SetExternalDelegate(autofill_external_delegate_.get()); |
| 256 autocomplete_history_manager_->SetExternalDelegate( |
| 257 autofill_external_delegate_.get()); |
| 258 } |
249 automation_tab_helper_.reset(new AutomationTabHelper(contents)); | 259 automation_tab_helper_.reset(new AutomationTabHelper(contents)); |
250 blocked_content_tab_helper_.reset(new BlockedContentTabHelper(this)); | 260 blocked_content_tab_helper_.reset(new BlockedContentTabHelper(this)); |
251 bookmark_tab_helper_.reset(new BookmarkTabHelper(this)); | 261 bookmark_tab_helper_.reset(new BookmarkTabHelper(this)); |
252 constrained_window_tab_helper_.reset(new ConstrainedWindowTabHelper(this)); | 262 constrained_window_tab_helper_.reset(new ConstrainedWindowTabHelper(this)); |
253 extension_tab_helper_.reset(new ExtensionTabHelper(this)); | 263 extension_tab_helper_.reset(new ExtensionTabHelper(this)); |
254 favicon_tab_helper_.reset(new FaviconTabHelper(contents)); | 264 favicon_tab_helper_.reset(new FaviconTabHelper(contents)); |
255 find_tab_helper_.reset(new FindTabHelper(contents)); | 265 find_tab_helper_.reset(new FindTabHelper(contents)); |
256 history_tab_helper_.reset(new HistoryTabHelper(contents)); | 266 history_tab_helper_.reset(new HistoryTabHelper(contents)); |
257 infobar_tab_helper_.reset(new InfoBarTabHelper(contents)); | 267 infobar_tab_helper_.reset(new InfoBarTabHelper(contents)); |
258 password_manager_delegate_.reset(new PasswordManagerDelegateImpl(this)); | 268 password_manager_delegate_.reset(new PasswordManagerDelegateImpl(this)); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 render_view_host()->Send( | 680 render_view_host()->Send( |
671 new ChromeViewMsg_SetClientSidePhishingDetection(routing_id(), | 681 new ChromeViewMsg_SetClientSidePhishingDetection(routing_id(), |
672 safe_browsing)); | 682 safe_browsing)); |
673 #endif | 683 #endif |
674 } | 684 } |
675 | 685 |
676 void TabContentsWrapper::ExitFullscreenMode() { | 686 void TabContentsWrapper::ExitFullscreenMode() { |
677 if (tab_contents() && render_view_host()) | 687 if (tab_contents() && render_view_host()) |
678 tab_contents()->render_view_host()->ExitFullscreen(); | 688 tab_contents()->render_view_host()->ExitFullscreen(); |
679 } | 689 } |
OLD | NEW |