| 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.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents.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/autofill/autocomplete_history_manager.h" | 9 #include "chrome/browser/autofill/autocomplete_history_manager.h" |
| 10 #include "chrome/browser/autofill/autofill_external_delegate.h" | 10 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 print_view_manager_.reset(new printing::PrintViewManager(this)); | 185 print_view_manager_.reset(new printing::PrintViewManager(this)); |
| 186 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); | 186 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); |
| 187 #endif | 187 #endif |
| 188 | 188 |
| 189 // Start the in-browser thumbnailing if the feature is enabled. | 189 // Start the in-browser thumbnailing if the feature is enabled. |
| 190 if (ShouldEnableInBrowserThumbnailing()) { | 190 if (ShouldEnableInBrowserThumbnailing()) { |
| 191 thumbnail_generator_.reset(new ThumbnailGenerator); | 191 thumbnail_generator_.reset(new ThumbnailGenerator); |
| 192 thumbnail_generator_->StartThumbnailing(web_contents_.get()); | 192 thumbnail_generator_->StartThumbnailing(web_contents_.get()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 195 // If this is not an incognito window, setup to handle one-click login. | 196 // If this is not an incognito window, setup to handle one-click login. |
| 196 // We don't want to check that the profile is already connected at this time | 197 // We don't want to check that the profile is already connected at this time |
| 197 // because the connected state may change while this tab is open. Having a | 198 // because the connected state may change while this tab is open. Having a |
| 198 // one-click signin helper attached does not cause problems if the profile | 199 // one-click signin helper attached does not cause problems if the profile |
| 199 // happens to be already connected. | 200 // happens to be already connected. |
| 200 #if defined(ENABLE_ONE_CLICK_SIGNIN) | |
| 201 if (OneClickSigninHelper::CanOffer(contents, "", false)) | 201 if (OneClickSigninHelper::CanOffer(contents, "", false)) |
| 202 one_click_signin_helper_.reset(new OneClickSigninHelper(contents)); | 202 OneClickSigninHelper::CreateForWebContents(contents); |
| 203 #endif | 203 #endif |
| 204 } | 204 } |
| 205 | 205 |
| 206 TabContents::~TabContents() { | 206 TabContents::~TabContents() { |
| 207 in_destructor_ = true; | 207 in_destructor_ = true; |
| 208 | 208 |
| 209 content::NotificationService::current()->Notify( | 209 content::NotificationService::current()->Notify( |
| 210 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, | 210 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
| 211 content::Source<TabContents>(this), | 211 content::Source<TabContents>(this), |
| 212 content::NotificationService::NoDetails()); | 212 content::NotificationService::NoDetails()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 //////////////////////////////////////////////////////////////////////////////// | 248 //////////////////////////////////////////////////////////////////////////////// |
| 249 // WebContentsObserver overrides | 249 // WebContentsObserver overrides |
| 250 | 250 |
| 251 void TabContents::WebContentsDestroyed(WebContents* tab) { | 251 void TabContents::WebContentsDestroyed(WebContents* tab) { |
| 252 // Destruction of the WebContents should only be done by us from our | 252 // Destruction of the WebContents should only be done by us from our |
| 253 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 253 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
| 254 // will attempt to access the WebContents and we'll crash. | 254 // will attempt to access the WebContents and we'll crash. |
| 255 DCHECK(in_destructor_); | 255 DCHECK(in_destructor_); |
| 256 } | 256 } |
| OLD | NEW |