| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked | 306 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked |
| 307 // some of these to close. CloseWindows is async, so it might get called | 307 // some of these to close. CloseWindows is async, so it might get called |
| 308 // twice before it runs. | 308 // twice before it runs. |
| 309 int size = static_cast<int>(child_windows_.size()); | 309 int size = static_cast<int>(child_windows_.size()); |
| 310 for (int i = size - 1; i >= 0; --i) { | 310 for (int i = size - 1; i >= 0; --i) { |
| 311 ConstrainedWindow* window = child_windows_[i]; | 311 ConstrainedWindow* window = child_windows_[i]; |
| 312 if (window) | 312 if (window) |
| 313 window->CloseConstrainedWindow(); | 313 window->CloseConstrainedWindow(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 // Notify any lasting InfobarDelegates that have not yet been removed that | |
| 317 // whatever infobar they were handling in this TabContents has closed, | |
| 318 // because the TabContents is going away entirely. | |
| 319 for (int i = 0; i < infobar_delegate_count(); ++i) { | |
| 320 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i); | |
| 321 delegate->InfoBarClosed(); | |
| 322 } | |
| 323 infobar_delegates_.clear(); | |
| 324 | |
| 325 // Notify any observer that have a reference on this tab contents. | 316 // Notify any observer that have a reference on this tab contents. |
| 326 NotificationService::current()->Notify( | 317 NotificationService::current()->Notify( |
| 327 NotificationType::TAB_CONTENTS_DESTROYED, | 318 NotificationType::TAB_CONTENTS_DESTROYED, |
| 328 Source<TabContents>(this), | 319 Source<TabContents>(this), |
| 329 NotificationService::NoDetails()); | 320 NotificationService::NoDetails()); |
| 330 | 321 |
| 322 // Notify any lasting InfobarDelegates that have not yet been removed that |
| 323 // whatever infobar they were handling in this TabContents has closed, |
| 324 // because the TabContents is going away entirely. |
| 325 // This must happen after the TAB_CONTENTS_DESTROYED notification as the |
| 326 // notification may trigger infobars calls that access their delegate. (and |
| 327 // some implementations of InfoBarDelegate do delete themselves on |
| 328 // InfoBarClosed()). |
| 329 for (int i = 0; i < infobar_delegate_count(); ++i) { |
| 330 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i); |
| 331 delegate->InfoBarClosed(); |
| 332 } |
| 333 infobar_delegates_.clear(); |
| 334 |
| 331 // TODO(brettw) this should be moved to the view. | 335 // TODO(brettw) this should be moved to the view. |
| 332 #if defined(OS_WIN) | 336 #if defined(OS_WIN) |
| 333 // If we still have a window handle, destroy it. GetNativeView can return | 337 // If we still have a window handle, destroy it. GetNativeView can return |
| 334 // NULL if this contents was part of a window that closed. | 338 // NULL if this contents was part of a window that closed. |
| 335 if (GetNativeView()) | 339 if (GetNativeView()) |
| 336 ::DestroyWindow(GetNativeView()); | 340 ::DestroyWindow(GetNativeView()); |
| 337 #endif | 341 #endif |
| 338 } | 342 } |
| 339 | 343 |
| 340 // static | 344 // static |
| (...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 NavigationController::LoadCommittedDetails& committed_details = | 2441 NavigationController::LoadCommittedDetails& committed_details = |
| 2438 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); | 2442 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); |
| 2439 ExpireInfoBars(committed_details); | 2443 ExpireInfoBars(committed_details); |
| 2440 break; | 2444 break; |
| 2441 } | 2445 } |
| 2442 | 2446 |
| 2443 default: | 2447 default: |
| 2444 NOTREACHED(); | 2448 NOTREACHED(); |
| 2445 } | 2449 } |
| 2446 } | 2450 } |
| OLD | NEW |