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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 #include "ui/gfx/color_palette.h" | 169 #include "ui/gfx/color_palette.h" |
| 170 #include "ui/native_theme/native_theme_win.h" | 170 #include "ui/native_theme/native_theme_win.h" |
| 171 #include "ui/views/win/scoped_fullscreen_visibility.h" | 171 #include "ui/views/win/scoped_fullscreen_visibility.h" |
| 172 #endif | 172 #endif |
| 173 | 173 |
| 174 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) | 174 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) |
| 175 #include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h" | 175 #include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h" |
| 176 #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h" | 176 #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h" |
| 177 #endif | 177 #endif |
| 178 | 178 |
| 179 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | |
| 180 #include "chrome/browser/ui/views/profiles/force_signout_dialog.h" | |
| 181 #endif | |
| 182 | |
| 179 using base::TimeDelta; | 183 using base::TimeDelta; |
| 180 using base::UserMetricsAction; | 184 using base::UserMetricsAction; |
| 181 using content::NativeWebKeyboardEvent; | 185 using content::NativeWebKeyboardEvent; |
| 182 using content::WebContents; | 186 using content::WebContents; |
| 183 using views::ColumnSet; | 187 using views::ColumnSet; |
| 184 using views::GridLayout; | 188 using views::GridLayout; |
| 185 using web_modal::WebContentsModalDialogHost; | 189 using web_modal::WebContentsModalDialogHost; |
| 186 | 190 |
| 187 namespace { | 191 namespace { |
| 188 | 192 |
| (...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1573 return true; | 1577 return true; |
| 1574 } | 1578 } |
| 1575 | 1579 |
| 1576 bool BrowserView::CanMinimize() const { | 1580 bool BrowserView::CanMinimize() const { |
| 1577 return true; | 1581 return true; |
| 1578 } | 1582 } |
| 1579 | 1583 |
| 1580 bool BrowserView::CanActivate() const { | 1584 bool BrowserView::CanActivate() const { |
| 1581 app_modal::AppModalDialogQueue* queue = | 1585 app_modal::AppModalDialogQueue* queue = |
| 1582 app_modal::AppModalDialogQueue::GetInstance(); | 1586 app_modal::AppModalDialogQueue::GetInstance(); |
| 1583 if (!queue->active_dialog() || !queue->active_dialog()->native_dialog() || | 1587 if ((!queue->active_dialog() || !queue->active_dialog()->native_dialog() || |
|
sky
2017/05/12 13:15:16
Continually adding dependencies from BrowserView o
| |
| 1584 !queue->active_dialog()->native_dialog()->IsShowing()) { | 1588 !queue->active_dialog()->native_dialog()->IsShowing()) |
| 1589 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | |
| 1590 && !ForceSignoutDialog::IsShowing() | |
| 1591 #endif | |
| 1592 ) { | |
| 1585 return true; | 1593 return true; |
| 1586 } | 1594 } |
| 1587 | 1595 |
| 1588 #if defined(USE_AURA) && defined(OS_CHROMEOS) | 1596 #if defined(USE_AURA) && defined(OS_CHROMEOS) |
| 1589 // On Aura window manager controls all windows so settings focus via PostTask | 1597 // 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. | 1598 // will make only worse because posted task will keep trying to steal focus. |
| 1591 queue->ActivateModalDialog(); | 1599 queue->ActivateModalDialog(); |
| 1592 #else | 1600 #else |
| 1593 // If another browser is app modal, flash and activate the modal browser. This | 1601 // 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 | 1602 // has to be done in a post task, otherwise if the user clicked on a window |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2588 content::RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView(); | 2596 content::RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView(); |
| 2589 if (!rwhv || !rwhv->HasFocus()) | 2597 if (!rwhv || !rwhv->HasFocus()) |
| 2590 return false; | 2598 return false; |
| 2591 // Calling |method| rather than using a fake key event is important since a | 2599 // Calling |method| rather than using a fake key event is important since a |
| 2592 // fake event might be consumed by the web content. | 2600 // fake event might be consumed by the web content. |
| 2593 (contents->*method)(); | 2601 (contents->*method)(); |
| 2594 return true; | 2602 return true; |
| 2595 } | 2603 } |
| 2596 | 2604 |
| 2597 void BrowserView::ActivateAppModalDialog() const { | 2605 void BrowserView::ActivateAppModalDialog() const { |
| 2606 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | |
| 2607 if (ForceSignoutDialog::IsShowing()) { | |
| 2608 ForceSignoutDialog::ActivateModalDialog(); | |
| 2609 return; | |
| 2610 } | |
| 2611 #endif | |
| 2598 // If another browser is app modal, flash and activate the modal browser. | 2612 // If another browser is app modal, flash and activate the modal browser. |
| 2599 app_modal::AppModalDialog* active_dialog = | 2613 app_modal::AppModalDialog* active_dialog = |
| 2600 app_modal::AppModalDialogQueue::GetInstance()->active_dialog(); | 2614 app_modal::AppModalDialogQueue::GetInstance()->active_dialog(); |
| 2601 if (!active_dialog) | 2615 if (!active_dialog) |
| 2602 return; | 2616 return; |
| 2603 | 2617 |
| 2604 Browser* modal_browser = | 2618 Browser* modal_browser = |
| 2605 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); | 2619 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); |
| 2606 if (modal_browser && (browser_.get() != modal_browser)) { | 2620 if (modal_browser && (browser_.get() != modal_browser)) { |
| 2607 modal_browser->window()->FlashFrame(true); | 2621 modal_browser->window()->FlashFrame(true); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2692 } | 2706 } |
| 2693 | 2707 |
| 2694 extensions::ActiveTabPermissionGranter* | 2708 extensions::ActiveTabPermissionGranter* |
| 2695 BrowserView::GetActiveTabPermissionGranter() { | 2709 BrowserView::GetActiveTabPermissionGranter() { |
| 2696 content::WebContents* web_contents = GetActiveWebContents(); | 2710 content::WebContents* web_contents = GetActiveWebContents(); |
| 2697 if (!web_contents) | 2711 if (!web_contents) |
| 2698 return nullptr; | 2712 return nullptr; |
| 2699 return extensions::TabHelper::FromWebContents(web_contents) | 2713 return extensions::TabHelper::FromWebContents(web_contents) |
| 2700 ->active_tab_permission_granter(); | 2714 ->active_tab_permission_granter(); |
| 2701 } | 2715 } |
| OLD | NEW |