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

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

Issue 1048473002: Linux/Mac Views: Make BrowserWindow::Show() behave like Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comments, check for Ash Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 652
653 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { 653 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const {
654 return *GetThemeProvider()->GetImageSkiaNamed(IDR_OTR_ICON); 654 return *GetThemeProvider()->GetImageSkiaNamed(IDR_OTR_ICON);
655 } 655 }
656 656
657 /////////////////////////////////////////////////////////////////////////////// 657 ///////////////////////////////////////////////////////////////////////////////
658 // BrowserView, BrowserWindow implementation: 658 // BrowserView, BrowserWindow implementation:
659 659
660 void BrowserView::Show() { 660 void BrowserView::Show() {
661 // If the window is already visible, just activate it. 661 // If the window is already visible, just activate it.
662 if (frame_->IsVisible()) { 662 if (frame_->IsVisible()) {
tapted 2015/03/30 23:01:04 just noticed this early exit condition.. it's prob
663 frame_->Activate(); 663 frame_->Activate();
664 return; 664 return;
665 } 665 }
666 666
667 // Showing the window doesn't make the browser window active right away. 667 // Showing the window doesn't make the browser window active right away.
668 // This can cause SetFocusToLocationBar() to skip setting focus to the 668 // This can cause SetFocusToLocationBar() to skip setting focus to the
669 // location bar. To avoid this we explicilty let SetFocusToLocationBar() 669 // location bar. To avoid this we explicilty let SetFocusToLocationBar()
670 // know that it's ok to steal focus. 670 // know that it's ok to steal focus.
671 force_location_bar_focus_ = true; 671 force_location_bar_focus_ = true;
672 672
673 // Setting the focus doesn't work when the window is invisible, so any focus 673 // Setting the focus doesn't work when the window is invisible, so any focus
674 // initialization that happened before this will be lost. 674 // initialization that happened before this will be lost.
675 // 675 //
676 // We really "should" restore the focus whenever the window becomes unhidden, 676 // We really "should" restore the focus whenever the window becomes unhidden,
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 #if !defined(OS_WIN)
688 // The Browser associated with this browser window must become the active
689 // browser at the time |Show()| is called. This is the natural behavior under
690 // Windows and Ash, but other platforms will not trigger
691 // OnWidgetActivationChanged() until we return to the runloop. Therefore any
692 // calls to Browser::GetLastActive() will return the wrong result if we do not
693 // explicitly set it here.
694 // A similar block also appears in BrowserWindowCocoa::Show().
695 if (browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH)
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698