Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 2862653002: If force-sign-in policy is enabled, popup warning dialog before window closing if auth token becom… (Closed)
Patch Set: refactor Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/browser/ui/browser_list.h" 54 #include "chrome/browser/ui/browser_list.h"
55 #include "chrome/browser/ui/browser_window_state.h" 55 #include "chrome/browser/ui/browser_window_state.h"
56 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" 56 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h"
57 #include "chrome/browser/ui/tabs/tab_menu_model.h" 57 #include "chrome/browser/ui/tabs/tab_menu_model.h"
58 #include "chrome/browser/ui/tabs/tab_strip_model.h" 58 #include "chrome/browser/ui/tabs/tab_strip_model.h"
59 #include "chrome/browser/ui/view_ids.h" 59 #include "chrome/browser/ui/view_ids.h"
60 #include "chrome/browser/ui/views/accelerator_table.h" 60 #include "chrome/browser/ui/views/accelerator_table.h"
61 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" 61 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h"
62 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 62 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
63 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" 63 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
64 #include "chrome/browser/ui/views/browser_modal_dialog.h"
64 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" 65 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h"
65 #include "chrome/browser/ui/views/download/download_shelf_view.h" 66 #include "chrome/browser/ui/views/download/download_shelf_view.h"
66 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" 67 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
67 #include "chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h" 68 #include "chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h"
68 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h" 69 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h"
69 #include "chrome/browser/ui/views/find_bar_host.h" 70 #include "chrome/browser/ui/views/find_bar_host.h"
70 #include "chrome/browser/ui/views/frame/browser_view_layout.h" 71 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
71 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" 72 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h"
72 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" 73 #include "chrome/browser/ui/views/frame/contents_layout_manager.h"
73 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 74 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 return true; 1574 return true;
1574 } 1575 }
1575 1576
1576 bool BrowserView::CanMinimize() const { 1577 bool BrowserView::CanMinimize() const {
1577 return true; 1578 return true;
1578 } 1579 }
1579 1580
1580 bool BrowserView::CanActivate() const { 1581 bool BrowserView::CanActivate() const {
1581 app_modal::AppModalDialogQueue* queue = 1582 app_modal::AppModalDialogQueue* queue =
1582 app_modal::AppModalDialogQueue::GetInstance(); 1583 app_modal::AppModalDialogQueue::GetInstance();
1583 if (!queue->active_dialog() || !queue->active_dialog()->native_dialog() || 1584 if ((!queue->active_dialog() || !queue->active_dialog()->native_dialog() ||
1584 !queue->active_dialog()->native_dialog()->IsShowing()) { 1585 !queue->active_dialog()->native_dialog()->IsShowing()) &&
1586 !BrowserModalDialogList::GetInstance()->IsShowing()) {
sky 2017/05/16 12:40:33 This has BrowserView needing to know about both ty
zmin 2017/05/16 22:22:02 Done.
1585 return true; 1587 return true;
1586 } 1588 }
1587 1589
1588 #if defined(USE_AURA) && defined(OS_CHROMEOS) 1590 #if defined(USE_AURA) && defined(OS_CHROMEOS)
1589 // On Aura window manager controls all windows so settings focus via PostTask 1591 // On Aura window manager controls all windows so settings focus via PostTask
1590 // will make only worse because posted task will keep trying to steal focus. 1592 // will make only worse because posted task will keep trying to steal focus.
1591 queue->ActivateModalDialog(); 1593 if (!BrowserModalDialogList::GetInstance()->ActivateModalDialog())
1594 queue->ActivateModalDialog();
1592 #else 1595 #else
1593 // If another browser is app modal, flash and activate the modal browser. This 1596 // If another browser is app modal, flash and activate the modal browser. This
1594 // has to be done in a post task, otherwise if the user clicked on a window 1597 // has to be done in a post task, otherwise if the user clicked on a window
1595 // that doesn't have the modal dialog the windows keep trying to get the focus 1598 // that doesn't have the modal dialog the windows keep trying to get the focus
1596 // from each other on Windows. http://crbug.com/141650. 1599 // from each other on Windows. http://crbug.com/141650.
1597 base::ThreadTaskRunnerHandle::Get()->PostTask( 1600 base::ThreadTaskRunnerHandle::Get()->PostTask(
1598 FROM_HERE, base::BindOnce(&BrowserView::ActivateAppModalDialog, 1601 FROM_HERE, base::BindOnce(&BrowserView::ActivateAppModalDialog,
1599 activate_modal_dialog_factory_.GetWeakPtr())); 1602 activate_modal_dialog_factory_.GetWeakPtr()));
1600 #endif 1603 #endif
1601 return false; 1604 return false;
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 content::RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView(); 2591 content::RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView();
2589 if (!rwhv || !rwhv->HasFocus()) 2592 if (!rwhv || !rwhv->HasFocus())
2590 return false; 2593 return false;
2591 // Calling |method| rather than using a fake key event is important since a 2594 // Calling |method| rather than using a fake key event is important since a
2592 // fake event might be consumed by the web content. 2595 // fake event might be consumed by the web content.
2593 (contents->*method)(); 2596 (contents->*method)();
2594 return true; 2597 return true;
2595 } 2598 }
2596 2599
2597 void BrowserView::ActivateAppModalDialog() const { 2600 void BrowserView::ActivateAppModalDialog() const {
2601 if (BrowserModalDialogList::GetInstance()->ActivateModalDialog())
2602 return;
2598 // If another browser is app modal, flash and activate the modal browser. 2603 // If another browser is app modal, flash and activate the modal browser.
2599 app_modal::AppModalDialog* active_dialog = 2604 app_modal::AppModalDialog* active_dialog =
2600 app_modal::AppModalDialogQueue::GetInstance()->active_dialog(); 2605 app_modal::AppModalDialogQueue::GetInstance()->active_dialog();
2601 if (!active_dialog) 2606 if (!active_dialog)
2602 return; 2607 return;
2603 2608
2604 Browser* modal_browser = 2609 Browser* modal_browser =
2605 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); 2610 chrome::FindBrowserWithWebContents(active_dialog->web_contents());
2606 if (modal_browser && (browser_.get() != modal_browser)) { 2611 if (modal_browser && (browser_.get() != modal_browser)) {
2607 modal_browser->window()->FlashFrame(true); 2612 modal_browser->window()->FlashFrame(true);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 } 2697 }
2693 2698
2694 extensions::ActiveTabPermissionGranter* 2699 extensions::ActiveTabPermissionGranter*
2695 BrowserView::GetActiveTabPermissionGranter() { 2700 BrowserView::GetActiveTabPermissionGranter() {
2696 content::WebContents* web_contents = GetActiveWebContents(); 2701 content::WebContents* web_contents = GetActiveWebContents();
2697 if (!web_contents) 2702 if (!web_contents)
2698 return nullptr; 2703 return nullptr;
2699 return extensions::TabHelper::FromWebContents(web_contents) 2704 return extensions::TabHelper::FromWebContents(web_contents)
2700 ->active_tab_permission_granter(); 2705 ->active_tab_permission_granter();
2701 } 2706 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698