OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 } | 1727 } |
1728 | 1728 |
1729 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { | 1729 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { |
1730 return this; | 1730 return this; |
1731 } | 1731 } |
1732 | 1732 |
1733 void BrowserView::OnWidgetDestroying(views::Widget* widget) { | 1733 void BrowserView::OnWidgetDestroying(views::Widget* widget) { |
1734 // Destroy any remaining WebContents early on. Doing so may result in | 1734 // Destroy any remaining WebContents early on. Doing so may result in |
1735 // calling back to one of the Views/LayoutManagers or supporting classes of | 1735 // calling back to one of the Views/LayoutManagers or supporting classes of |
1736 // BrowserView. By destroying here we ensure all said classes are valid. | 1736 // BrowserView. By destroying here we ensure all said classes are valid. |
1737 ScopedVector<content::WebContents> contents; | 1737 std::vector<content::WebContents*> contents; |
1738 while (browser()->tab_strip_model()->count()) | 1738 while (browser()->tab_strip_model()->count()) |
1739 contents.push_back(browser()->tab_strip_model()->DetachWebContentsAt(0)); | 1739 contents.push_back(browser()->tab_strip_model()->DetachWebContentsAt(0)); |
| 1740 // Note: The BrowserViewTest tests rely on the contents being destroyed in the |
| 1741 // order that they were present in the tab strip. |
| 1742 for (auto* content : contents) |
| 1743 delete content; |
1740 } | 1744 } |
1741 | 1745 |
1742 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, | 1746 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, |
1743 bool active) { | 1747 bool active) { |
1744 if (active) | 1748 if (active) |
1745 BrowserList::SetLastActive(browser_.get()); | 1749 BrowserList::SetLastActive(browser_.get()); |
1746 else | 1750 else |
1747 BrowserList::NotifyBrowserNoLongerActive(browser_.get()); | 1751 BrowserList::NotifyBrowserNoLongerActive(browser_.get()); |
1748 | 1752 |
1749 if (!extension_keybinding_registry_ && | 1753 if (!extension_keybinding_registry_ && |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2585 } | 2589 } |
2586 | 2590 |
2587 extensions::ActiveTabPermissionGranter* | 2591 extensions::ActiveTabPermissionGranter* |
2588 BrowserView::GetActiveTabPermissionGranter() { | 2592 BrowserView::GetActiveTabPermissionGranter() { |
2589 content::WebContents* web_contents = GetActiveWebContents(); | 2593 content::WebContents* web_contents = GetActiveWebContents(); |
2590 if (!web_contents) | 2594 if (!web_contents) |
2591 return nullptr; | 2595 return nullptr; |
2592 return extensions::TabHelper::FromWebContents(web_contents) | 2596 return extensions::TabHelper::FromWebContents(web_contents) |
2593 ->active_tab_permission_granter(); | 2597 ->active_tab_permission_granter(); |
2594 } | 2598 } |
OLD | NEW |