Chromium Code Reviews| 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 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1814 // BrowserView. By destroying here we ensure all said classes are valid. | 1814 // BrowserView. By destroying here we ensure all said classes are valid. |
| 1815 std::vector<content::WebContents*> contents; | 1815 std::vector<content::WebContents*> contents; |
| 1816 while (browser()->tab_strip_model()->count()) | 1816 while (browser()->tab_strip_model()->count()) |
| 1817 contents.push_back(browser()->tab_strip_model()->DetachWebContentsAt(0)); | 1817 contents.push_back(browser()->tab_strip_model()->DetachWebContentsAt(0)); |
| 1818 // Note: The BrowserViewTest tests rely on the contents being destroyed in the | 1818 // Note: The BrowserViewTest tests rely on the contents being destroyed in the |
| 1819 // order that they were present in the tab strip. | 1819 // order that they were present in the tab strip. |
| 1820 for (auto* content : contents) | 1820 for (auto* content : contents) |
| 1821 delete content; | 1821 delete content; |
| 1822 } | 1822 } |
| 1823 | 1823 |
| 1824 void BrowserView::OnWidgetVisibilityChanged(views::Widget* widget, | |
|
sky
2017/03/27 15:47:51
I think this logic belongs closer to the permissio
Qiang(Joe) Xu
2017/03/27 21:09:52
Yeah, I agree. And checking activation instead of
| |
| 1825 bool visible) { | |
| 1826 DCHECK_EQ(GetWidget(), widget); | |
| 1827 if (widget->IsClosed() || !GetActiveWebContents()) | |
| 1828 return; | |
| 1829 | |
| 1830 PermissionRequestManager::FromWebContents(GetActiveWebContents()) | |
| 1831 ->OnBrowserVisibilityChanged(visible); | |
| 1832 } | |
| 1833 | |
| 1824 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, | 1834 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, |
| 1825 bool active) { | 1835 bool active) { |
| 1826 if (active) | 1836 if (active) |
| 1827 BrowserList::SetLastActive(browser_.get()); | 1837 BrowserList::SetLastActive(browser_.get()); |
| 1828 else | 1838 else |
| 1829 BrowserList::NotifyBrowserNoLongerActive(browser_.get()); | 1839 BrowserList::NotifyBrowserNoLongerActive(browser_.get()); |
| 1830 | 1840 |
| 1831 if (!extension_keybinding_registry_ && | 1841 if (!extension_keybinding_registry_ && |
| 1832 GetFocusManager()) { // focus manager can be null in tests. | 1842 GetFocusManager()) { // focus manager can be null in tests. |
| 1833 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 1843 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2676 } | 2686 } |
| 2677 | 2687 |
| 2678 extensions::ActiveTabPermissionGranter* | 2688 extensions::ActiveTabPermissionGranter* |
| 2679 BrowserView::GetActiveTabPermissionGranter() { | 2689 BrowserView::GetActiveTabPermissionGranter() { |
| 2680 content::WebContents* web_contents = GetActiveWebContents(); | 2690 content::WebContents* web_contents = GetActiveWebContents(); |
| 2681 if (!web_contents) | 2691 if (!web_contents) |
| 2682 return nullptr; | 2692 return nullptr; |
| 2683 return extensions::TabHelper::FromWebContents(web_contents) | 2693 return extensions::TabHelper::FromWebContents(web_contents) |
| 2684 ->active_tab_permission_granter(); | 2694 ->active_tab_permission_granter(); |
| 2685 } | 2695 } |
| OLD | NEW |