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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" | 75 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" |
| 76 #include "chrome/browser/ui/views/ime/ime_warning_bubble_view.h" | 76 #include "chrome/browser/ui/views/ime/ime_warning_bubble_view.h" |
| 77 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 77 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 78 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 78 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 79 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 79 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 80 #include "chrome/browser/ui/views/location_bar/star_view.h" | 80 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 81 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" | 81 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
| 82 #include "chrome/browser/ui/views/new_back_shortcut_bubble.h" | 82 #include "chrome/browser/ui/views/new_back_shortcut_bubble.h" |
| 83 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 83 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 84 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" | 84 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" |
| 85 #include "chrome/browser/ui/views/profiles/force_signout_dialog.h" | |
| 85 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" | 86 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" |
| 86 #include "chrome/browser/ui/views/status_bubble_views.h" | 87 #include "chrome/browser/ui/views/status_bubble_views.h" |
| 87 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 88 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
| 88 #include "chrome/browser/ui/views/tabs/tab.h" | 89 #include "chrome/browser/ui/views/tabs/tab.h" |
| 89 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 90 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 90 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 91 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 91 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 92 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 92 #include "chrome/browser/ui/views/toolbar/reload_button.h" | 93 #include "chrome/browser/ui/views/toolbar/reload_button.h" |
| 93 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 94 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 94 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" | 95 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
| (...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1574 return true; | 1575 return true; |
| 1575 } | 1576 } |
| 1576 | 1577 |
| 1577 bool BrowserView::CanMinimize() const { | 1578 bool BrowserView::CanMinimize() const { |
| 1578 return true; | 1579 return true; |
| 1579 } | 1580 } |
| 1580 | 1581 |
| 1581 bool BrowserView::CanActivate() const { | 1582 bool BrowserView::CanActivate() const { |
| 1582 app_modal::AppModalDialogQueue* queue = | 1583 app_modal::AppModalDialogQueue* queue = |
| 1583 app_modal::AppModalDialogQueue::GetInstance(); | 1584 app_modal::AppModalDialogQueue::GetInstance(); |
| 1584 if (!queue->active_dialog() || !queue->active_dialog()->native_dialog() || | 1585 if ((!queue->active_dialog() || !queue->active_dialog()->native_dialog() || |
|
sky
2017/05/10 15:43:25
Ugh! Sorry, I think I sent you down the wrong path
| |
| 1585 !queue->active_dialog()->native_dialog()->IsShowing()) { | 1586 !queue->active_dialog()->native_dialog()->IsShowing()) |
| 1587 #if defined(OS_WIN) || defined(OS_LINUX) | |
| 1588 && !ForceSignoutDialog::IsShowing() | |
| 1589 #endif | |
| 1590 ) { | |
| 1586 return true; | 1591 return true; |
| 1587 } | 1592 } |
| 1588 | 1593 |
| 1589 #if defined(USE_AURA) && defined(OS_CHROMEOS) | 1594 #if defined(USE_AURA) && defined(OS_CHROMEOS) |
| 1590 // On Aura window manager controls all windows so settings focus via PostTask | 1595 // On Aura window manager controls all windows so settings focus via PostTask |
| 1591 // will make only worse because posted task will keep trying to steal focus. | 1596 // will make only worse because posted task will keep trying to steal focus. |
| 1592 queue->ActivateModalDialog(); | 1597 queue->ActivateModalDialog(); |
| 1593 #else | 1598 #else |
| 1594 // If another browser is app modal, flash and activate the modal browser. This | 1599 // If another browser is app modal, flash and activate the modal browser. This |
| 1595 // has to be done in a post task, otherwise if the user clicked on a window | 1600 // has to be done in a post task, otherwise if the user clicked on a window |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2596 content::RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView(); | 2601 content::RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView(); |
| 2597 if (!rwhv || !rwhv->HasFocus()) | 2602 if (!rwhv || !rwhv->HasFocus()) |
| 2598 return false; | 2603 return false; |
| 2599 // Calling |method| rather than using a fake key event is important since a | 2604 // Calling |method| rather than using a fake key event is important since a |
| 2600 // fake event might be consumed by the web content. | 2605 // fake event might be consumed by the web content. |
| 2601 (contents->*method)(); | 2606 (contents->*method)(); |
| 2602 return true; | 2607 return true; |
| 2603 } | 2608 } |
| 2604 | 2609 |
| 2605 void BrowserView::ActivateAppModalDialog() const { | 2610 void BrowserView::ActivateAppModalDialog() const { |
| 2611 #if defined(OS_WIN) || defined(OS_LINUX) | |
| 2612 if (ForceSignoutDialog::IsShowing()) { | |
| 2613 ForceSignoutDialog::ActivateModalDialog(); | |
| 2614 return; | |
| 2615 } | |
| 2616 #endif | |
| 2606 // If another browser is app modal, flash and activate the modal browser. | 2617 // If another browser is app modal, flash and activate the modal browser. |
| 2607 app_modal::AppModalDialog* active_dialog = | 2618 app_modal::AppModalDialog* active_dialog = |
| 2608 app_modal::AppModalDialogQueue::GetInstance()->active_dialog(); | 2619 app_modal::AppModalDialogQueue::GetInstance()->active_dialog(); |
| 2609 if (!active_dialog) | 2620 if (!active_dialog) |
| 2610 return; | 2621 return; |
| 2611 | 2622 |
| 2612 Browser* modal_browser = | 2623 Browser* modal_browser = |
| 2613 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); | 2624 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); |
| 2614 if (modal_browser && (browser_.get() != modal_browser)) { | 2625 if (modal_browser && (browser_.get() != modal_browser)) { |
| 2615 modal_browser->window()->FlashFrame(true); | 2626 modal_browser->window()->FlashFrame(true); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2695 } | 2706 } |
| 2696 | 2707 |
| 2697 extensions::ActiveTabPermissionGranter* | 2708 extensions::ActiveTabPermissionGranter* |
| 2698 BrowserView::GetActiveTabPermissionGranter() { | 2709 BrowserView::GetActiveTabPermissionGranter() { |
| 2699 content::WebContents* web_contents = GetActiveWebContents(); | 2710 content::WebContents* web_contents = GetActiveWebContents(); |
| 2700 if (!web_contents) | 2711 if (!web_contents) |
| 2701 return nullptr; | 2712 return nullptr; |
| 2702 return extensions::TabHelper::FromWebContents(web_contents) | 2713 return extensions::TabHelper::FromWebContents(web_contents) |
| 2703 ->active_tab_permission_granter(); | 2714 ->active_tab_permission_granter(); |
| 2704 } | 2715 } |
| OLD | NEW |