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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 677 // but I think initializing is the only time where this can happen where | 677 // but I think initializing is the only time where this can happen where |
| 678 // there is some focus change we need to pick up, and this is easier than | 678 // there is some focus change we need to pick up, and this is easier than |
| 679 // plumbing through an un-hide message all the way from the frame. | 679 // plumbing through an un-hide message all the way from the frame. |
| 680 // | 680 // |
| 681 // If we do find there are cases where we need to restore the focus on show, | 681 // If we do find there are cases where we need to restore the focus on show, |
| 682 // that should be added and this should be removed. | 682 // that should be added and this should be removed. |
| 683 RestoreFocus(); | 683 RestoreFocus(); |
| 684 | 684 |
| 685 frame_->Show(); | 685 frame_->Show(); |
| 686 | 686 |
| 687 // A similar block also appears in BrowserWindowCocoa::Show(). | |
|
Peter Kasting
2015/03/28 02:35:38
Nit: I would replace the last sentence of the comm
| |
| 688 #if !defined(OS_WIN) | |
|
tapted
2015/03/28 03:10:57
add `&& !defined(OS_CHROMEOS)`?
The downside of n
Peter Kasting
2015/03/28 03:12:52
Hmm, is OS_CHROMEOS right then? It sounds like th
tapted
2015/03/28 03:35:31
Yeah - it would be a complexity/correctness tradeo
| |
| 689 // The Browser associated with this browser window must become the active | |
| 690 // browser at the time |Show()| is called. This is the natural behavior under | |
| 691 // Windows, but Linux Views will not trigger OnWidgetActivationChanged() | |
| 692 // until we return to the runloop. Therefore any calls to | |
| 693 // Browser::GetLastActive() will return the wrong result if we do not | |
| 694 // explicitly set it here. | |
| 695 // Mac Views will likely have the same problem, so do this for Mac as well. | |
|
tapted
2015/03/28 03:10:56
yup - activation on Mac is always asynchronous.
| |
| 696 BrowserList::SetLastActive(browser()); | |
| 697 #endif | |
| 698 | |
| 687 force_location_bar_focus_ = false; | 699 force_location_bar_focus_ = false; |
| 688 | 700 |
| 689 browser()->OnWindowDidShow(); | 701 browser()->OnWindowDidShow(); |
| 690 | 702 |
| 691 chrome::MaybeShowInvertBubbleView(this); | 703 chrome::MaybeShowInvertBubbleView(this); |
| 692 } | 704 } |
| 693 | 705 |
| 694 void BrowserView::ShowInactive() { | 706 void BrowserView::ShowInactive() { |
| 695 if (!frame_->IsVisible()) | 707 if (!frame_->IsVisible()) |
| 696 frame_->ShowInactive(); | 708 frame_->ShowInactive(); |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2613 return immersive_mode_controller()->IsEnabled(); | 2625 return immersive_mode_controller()->IsEnabled(); |
| 2614 } | 2626 } |
| 2615 | 2627 |
| 2616 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2628 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
| 2617 return GetWidget(); | 2629 return GetWidget(); |
| 2618 } | 2630 } |
| 2619 | 2631 |
| 2620 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2632 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
| 2621 return top_container_->GetBoundsInScreen(); | 2633 return top_container_->GetBoundsInScreen(); |
| 2622 } | 2634 } |
| OLD | NEW |