| 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() { |
| 661 #if !defined(OS_WIN) |
| 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 |
| 664 // Windows and Ash, but other platforms will not trigger |
| 665 // OnWidgetActivationChanged() until we return to the runloop. Therefore any |
| 666 // calls to Browser::GetLastActive() will return the wrong result if we do not |
| 667 // explicitly set it here. |
| 668 // A similar block also appears in BrowserWindowCocoa::Show(). |
| 669 if (browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) |
| 670 BrowserList::SetLastActive(browser()); |
| 671 #endif |
| 672 |
| 661 // If the window is already visible, just activate it. | 673 // If the window is already visible, just activate it. |
| 662 if (frame_->IsVisible()) { | 674 if (frame_->IsVisible()) { |
| 663 frame_->Activate(); | 675 frame_->Activate(); |
| 664 return; | 676 return; |
| 665 } | 677 } |
| 666 | 678 |
| 667 // Showing the window doesn't make the browser window active right away. | 679 // Showing the window doesn't make the browser window active right away. |
| 668 // This can cause SetFocusToLocationBar() to skip setting focus to the | 680 // This can cause SetFocusToLocationBar() to skip setting focus to the |
| 669 // location bar. To avoid this we explicilty let SetFocusToLocationBar() | 681 // location bar. To avoid this we explicilty let SetFocusToLocationBar() |
| 670 // know that it's ok to steal focus. | 682 // know that it's ok to steal focus. |
| (...skipping 1942 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 |