| 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/ui/tab_contents/tab_contents_wrapper.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "chrome/browser/autocomplete_history_manager.h" | 9 #include "chrome/browser/autocomplete_history_manager.h" |
| 10 #include "chrome/browser/autofill/autofill_external_delegate.h" | 10 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| 11 #include "chrome/browser/autofill/autofill_manager.h" | 11 #include "chrome/browser/autofill/autofill_manager.h" |
| 12 #include "chrome/browser/automation/automation_tab_helper.h" | 12 #include "chrome/browser/automation/automation_tab_helper.h" |
| 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 14 #include "chrome/browser/download/download_request_limiter_observer.h" | 14 #include "chrome/browser/download/download_request_limiter_observer.h" |
| 15 #include "chrome/browser/extensions/extension_tab_helper.h" | 15 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 16 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 16 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
| 17 #include "chrome/browser/external_protocol/external_protocol_observer.h" | 17 #include "chrome/browser/external_protocol/external_protocol_observer.h" |
| 18 #include "chrome/browser/favicon/favicon_tab_helper.h" | 18 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 19 #include "chrome/browser/history/history_tab_helper.h" | 19 #include "chrome/browser/history/history_tab_helper.h" |
| 20 #include "chrome/browser/infobars/infobar_tab_helper.h" | 20 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 21 #include "chrome/browser/omnibox_search_hint.h" | 21 #include "chrome/browser/omnibox_search_hint.h" |
| 22 #include "chrome/browser/password_manager/password_manager.h" | 22 #include "chrome/browser/password_manager/password_manager.h" |
| 23 #include "chrome/browser/password_manager_delegate_impl.h" | 23 #include "chrome/browser/password_manager_delegate_impl.h" |
| 24 #include "chrome/browser/plugin_observer.h" | 24 #include "chrome/browser/plugin_observer.h" |
| 25 #include "chrome/browser/prerender/prerender_tab_helper.h" | 25 #include "chrome/browser/prerender/prerender_tab_helper.h" |
| 26 #include "chrome/browser/printing/print_preview_message_handler.h" | 26 #include "chrome/browser/printing/print_preview_message_handler.h" |
| 27 #include "chrome/browser/printing/print_view_manager.h" | 27 #include "chrome/browser/printing/print_view_manager.h" |
| 28 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" | 28 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" |
| 29 #include "chrome/browser/sessions/restore_tab_helper.h" | 29 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 30 #include "chrome/browser/signin/one_click_signin.h" |
| 31 #include "chrome/browser/signin/token_service.h" |
| 30 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 32 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
| 31 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 33 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 32 #include "chrome/browser/translate/translate_tab_helper.h" | 34 #include "chrome/browser/translate/translate_tab_helper.h" |
| 33 #include "chrome/browser/ui/alternate_error_tab_observer.h" | 35 #include "chrome/browser/ui/alternate_error_tab_observer.h" |
| 34 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 36 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 35 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 37 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 36 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 38 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 37 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 39 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 38 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 40 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 39 #include "chrome/browser/ui/pdf/pdf_tab_observer.h" | 41 #include "chrome/browser/ui/pdf/pdf_tab_observer.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 sad_tab_observer_.reset(new SadTabObserver(contents)); | 123 sad_tab_observer_.reset(new SadTabObserver(contents)); |
| 122 safe_browsing_tab_observer_.reset( | 124 safe_browsing_tab_observer_.reset( |
| 123 new safe_browsing::SafeBrowsingTabObserver(this)); | 125 new safe_browsing::SafeBrowsingTabObserver(this)); |
| 124 | 126 |
| 125 // Start the in-browser thumbnailing if the feature is enabled. | 127 // Start the in-browser thumbnailing if the feature is enabled. |
| 126 if (CommandLine::ForCurrentProcess()->HasSwitch( | 128 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 127 switches::kEnableInBrowserThumbnailing)) { | 129 switches::kEnableInBrowserThumbnailing)) { |
| 128 thumbnail_generation_observer_.reset(new ThumbnailGenerator); | 130 thumbnail_generation_observer_.reset(new ThumbnailGenerator); |
| 129 thumbnail_generation_observer_->StartThumbnailing(web_contents_.get()); | 131 thumbnail_generation_observer_->StartThumbnailing(web_contents_.get()); |
| 130 } | 132 } |
| 133 |
| 134 // If the profile is not already connected to a Google account and this is |
| 135 // not an incognito window, setup to handle one-click login. |
| 136 #if !defined(OS_CHROMEOS) |
| 137 if (OneClickSigninManager::CanOffer(contents)) |
| 138 one_click_signin_manager_.reset(new OneClickSigninManager(contents)); |
| 139 #endif |
| 131 } | 140 } |
| 132 | 141 |
| 133 TabContentsWrapper::~TabContentsWrapper() { | 142 TabContentsWrapper::~TabContentsWrapper() { |
| 134 in_destructor_ = true; | 143 in_destructor_ = true; |
| 135 | 144 |
| 136 // Need to tear down infobars before the TabContents goes away. | 145 // Need to tear down infobars before the TabContents goes away. |
| 137 // TODO(avi): Can we get this handled by the tab helper itself? | 146 // TODO(avi): Can we get this handled by the tab helper itself? |
| 138 infobar_tab_helper_.reset(); | 147 infobar_tab_helper_.reset(); |
| 139 } | 148 } |
| 140 | 149 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 191 |
| 183 //////////////////////////////////////////////////////////////////////////////// | 192 //////////////////////////////////////////////////////////////////////////////// |
| 184 // WebContentsObserver overrides | 193 // WebContentsObserver overrides |
| 185 | 194 |
| 186 void TabContentsWrapper::WebContentsDestroyed(WebContents* tab) { | 195 void TabContentsWrapper::WebContentsDestroyed(WebContents* tab) { |
| 187 // Destruction of the WebContents should only be done by us from our | 196 // Destruction of the WebContents should only be done by us from our |
| 188 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 197 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
| 189 // will attempt to access the TabContents and we'll crash. | 198 // will attempt to access the TabContents and we'll crash. |
| 190 DCHECK(in_destructor_); | 199 DCHECK(in_destructor_); |
| 191 } | 200 } |
| OLD | NEW |