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

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

Issue 1158523002: Add user_gesture param to BaseWindow::Show Base URL: https://chromium.googlesource.com/chromium/src.git@ug3_BaseWindow_Activate
Patch Set: Update callers Created 5 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 <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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 return browser_->tab_strip_model()->GetActiveWebContents(); 650 return browser_->tab_strip_model()->GetActiveWebContents();
651 } 651 }
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(bool user_gesture) {
661 #if !defined(OS_WIN) 661 #if !defined(OS_WIN)
662 // The Browser associated with this browser window must become the active 662 // The Browser associated with this browser window must become the active
663 // browser at the time |Show()| is called. This is the natural behavior under 663 // browser at the time |Show()| is called. This is the natural behavior under
664 // Windows and Ash, but other platforms will not trigger 664 // Windows and Ash, but other platforms will not trigger
665 // OnWidgetActivationChanged() until we return to the runloop. Therefore any 665 // OnWidgetActivationChanged() until we return to the runloop. Therefore any
666 // calls to Browser::GetLastActive() will return the wrong result if we do not 666 // calls to Browser::GetLastActive() will return the wrong result if we do not
667 // explicitly set it here. 667 // explicitly set it here.
668 // A similar block also appears in BrowserWindowCocoa::Show(). 668 // A similar block also appears in BrowserWindowCocoa::Show().
669 if (browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) 669 if (browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH)
670 BrowserList::SetLastActive(browser()); 670 BrowserList::SetLastActive(browser());
671 #endif 671 #endif
672 672
673 // If the window is already visible, just activate it. 673 // If the window is already visible, just activate it.
674 if (frame_->IsVisible()) { 674 if (frame_->IsVisible()) {
675 // TODO(johnme): Pass user_gesture to Activate.
675 frame_->Activate(); 676 frame_->Activate();
676 return; 677 return;
677 } 678 }
678 679
679 // Showing the window doesn't make the browser window active right away. 680 // Showing the window doesn't make the browser window active right away.
680 // This can cause SetFocusToLocationBar() to skip setting focus to the 681 // This can cause SetFocusToLocationBar() to skip setting focus to the
681 // location bar. To avoid this we explicilty let SetFocusToLocationBar() 682 // location bar. To avoid this we explicilty let SetFocusToLocationBar()
682 // know that it's ok to steal focus. 683 // know that it's ok to steal focus.
683 force_location_bar_focus_ = true; 684 force_location_bar_focus_ = true;
684 685
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2610 return immersive_mode_controller()->IsEnabled(); 2611 return immersive_mode_controller()->IsEnabled();
2611 } 2612 }
2612 2613
2613 views::Widget* BrowserView::GetBubbleAssociatedWidget() { 2614 views::Widget* BrowserView::GetBubbleAssociatedWidget() {
2614 return GetWidget(); 2615 return GetWidget();
2615 } 2616 }
2616 2617
2617 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { 2618 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() {
2618 return top_container_->GetBoundsInScreen(); 2619 return top_container_->GetBoundsInScreen();
2619 } 2620 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698