| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 #if !defined(OS_ANDROID) | 129 #if !defined(OS_ANDROID) |
| 128 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); | 130 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); |
| 129 #endif | 131 #endif |
| 130 | 132 |
| 131 // Start the in-browser thumbnailing if the feature is enabled. | 133 // Start the in-browser thumbnailing if the feature is enabled. |
| 132 if (CommandLine::ForCurrentProcess()->HasSwitch( | 134 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 133 switches::kEnableInBrowserThumbnailing)) { | 135 switches::kEnableInBrowserThumbnailing)) { |
| 134 thumbnail_generation_observer_.reset(new ThumbnailGenerator); | 136 thumbnail_generation_observer_.reset(new ThumbnailGenerator); |
| 135 thumbnail_generation_observer_->StartThumbnailing(web_contents_.get()); | 137 thumbnail_generation_observer_->StartThumbnailing(web_contents_.get()); |
| 136 } | 138 } |
| 139 |
| 140 // If the profile is not already connected to a Google account and this is |
| 141 // not an incognito window, setup to handle one-click login. |
| 142 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 143 if (OneClickSigninManager::CanOffer(contents)) |
| 144 one_click_signin_manager_.reset(new OneClickSigninManager(contents)); |
| 145 #endif |
| 137 } | 146 } |
| 138 | 147 |
| 139 TabContentsWrapper::~TabContentsWrapper() { | 148 TabContentsWrapper::~TabContentsWrapper() { |
| 140 in_destructor_ = true; | 149 in_destructor_ = true; |
| 141 | 150 |
| 142 // Need to tear down infobars before the TabContents goes away. | 151 // Need to tear down infobars before the TabContents goes away. |
| 143 // TODO(avi): Can we get this handled by the tab helper itself? | 152 // TODO(avi): Can we get this handled by the tab helper itself? |
| 144 infobar_tab_helper_.reset(); | 153 infobar_tab_helper_.reset(); |
| 145 } | 154 } |
| 146 | 155 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 197 |
| 189 //////////////////////////////////////////////////////////////////////////////// | 198 //////////////////////////////////////////////////////////////////////////////// |
| 190 // WebContentsObserver overrides | 199 // WebContentsObserver overrides |
| 191 | 200 |
| 192 void TabContentsWrapper::WebContentsDestroyed(WebContents* tab) { | 201 void TabContentsWrapper::WebContentsDestroyed(WebContents* tab) { |
| 193 // Destruction of the WebContents should only be done by us from our | 202 // Destruction of the WebContents should only be done by us from our |
| 194 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 203 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
| 195 // will attempt to access the TabContents and we'll crash. | 204 // will attempt to access the TabContents and we'll crash. |
| 196 DCHECK(in_destructor_); | 205 DCHECK(in_destructor_); |
| 197 } | 206 } |
| OLD | NEW |