| 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 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 } | 1745 } |
| 1746 | 1746 |
| 1747 views::View* BrowserView::GetContentsView() { | 1747 views::View* BrowserView::GetContentsView() { |
| 1748 return contents_web_view_; | 1748 return contents_web_view_; |
| 1749 } | 1749 } |
| 1750 | 1750 |
| 1751 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { | 1751 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { |
| 1752 return this; | 1752 return this; |
| 1753 } | 1753 } |
| 1754 | 1754 |
| 1755 void BrowserView::OnWidgetDestroying(views::Widget* widget) { |
| 1756 // Destroy any remaining WebContents early on. Doing so may result in |
| 1757 // calling back to one of the Views/LayoutManagers or supporting classes of |
| 1758 // BrowserView. By destroying here we ensure all said classes are valid. |
| 1759 ScopedVector<content::WebContents> contents; |
| 1760 while (browser()->tab_strip_model()->count()) |
| 1761 contents.push_back(browser()->tab_strip_model()->DetachWebContentsAt(0)); |
| 1762 } |
| 1763 |
| 1755 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, | 1764 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, |
| 1756 bool active) { | 1765 bool active) { |
| 1757 if (active) | 1766 if (active) |
| 1758 BrowserList::SetLastActive(browser_.get()); | 1767 BrowserList::SetLastActive(browser_.get()); |
| 1759 | 1768 |
| 1760 if (!extension_keybinding_registry_ && | 1769 if (!extension_keybinding_registry_ && |
| 1761 GetFocusManager()) { // focus manager can be null in tests. | 1770 GetFocusManager()) { // focus manager can be null in tests. |
| 1762 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 1771 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
| 1763 browser_->profile(), GetFocusManager(), | 1772 browser_->profile(), GetFocusManager(), |
| 1764 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, this)); | 1773 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, this)); |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2595 } | 2604 } |
| 2596 | 2605 |
| 2597 extensions::ActiveTabPermissionGranter* | 2606 extensions::ActiveTabPermissionGranter* |
| 2598 BrowserView::GetActiveTabPermissionGranter() { | 2607 BrowserView::GetActiveTabPermissionGranter() { |
| 2599 content::WebContents* web_contents = GetActiveWebContents(); | 2608 content::WebContents* web_contents = GetActiveWebContents(); |
| 2600 if (!web_contents) | 2609 if (!web_contents) |
| 2601 return nullptr; | 2610 return nullptr; |
| 2602 return extensions::TabHelper::FromWebContents(web_contents) | 2611 return extensions::TabHelper::FromWebContents(web_contents) |
| 2603 ->active_tab_permission_granter(); | 2612 ->active_tab_permission_granter(); |
| 2604 } | 2613 } |
| OLD | NEW |