OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/frame/browser_view.h" | 5 #include "chrome/browser/views/frame/browser_view.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 // We really "should" restore the focus whenever the window becomes unhidden, | 668 // We really "should" restore the focus whenever the window becomes unhidden, |
669 // but I think initializing is the only time where this can happen where | 669 // but I think initializing is the only time where this can happen where |
670 // there is some focus change we need to pick up, and this is easier than | 670 // there is some focus change we need to pick up, and this is easier than |
671 // plumbing through an un-hide message all the way from the frame. | 671 // plumbing through an un-hide message all the way from the frame. |
672 // | 672 // |
673 // If we do find there are cases where we need to restore the focus on show, | 673 // If we do find there are cases where we need to restore the focus on show, |
674 // that should be added and this should be removed. | 674 // that should be added and this should be removed. |
675 RestoreFocus(); | 675 RestoreFocus(); |
676 | 676 |
677 frame_->GetWindow()->Show(); | 677 frame_->GetWindow()->Show(); |
| 678 |
| 679 // The following block also appears in BrowserWindowGtk::Show(). |
| 680 #if !defined(OS_WIN) |
| 681 // The Browser associated with this browser window must become the active |
| 682 // browser at the time Show() is called. This is the natural behavior under |
| 683 // Windows, but gtk_widget_show won't show the widget (and therefore won't |
| 684 // call OnFocusIn()) until we return to the runloop. Therefore any calls to |
| 685 // BrowserList::GetLastActive() (for example, in bookmark_util), will return |
| 686 // the previous browser instead if we don't explicitly set it here. |
| 687 BrowserList::SetLastActive(browser()); |
| 688 #endif |
678 } | 689 } |
679 | 690 |
680 void BrowserView::SetBounds(const gfx::Rect& bounds) { | 691 void BrowserView::SetBounds(const gfx::Rect& bounds) { |
681 GetWidget()->SetBounds(bounds); | 692 GetWidget()->SetBounds(bounds); |
682 } | 693 } |
683 | 694 |
684 void BrowserView::Close() { | 695 void BrowserView::Close() { |
685 BrowserBubbleHost::Close(); | 696 BrowserBubbleHost::Close(); |
686 | 697 |
687 frame_->GetWindow()->Close(); | 698 frame_->GetWindow()->Close(); |
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); | 2250 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); |
2240 | 2251 |
2241 return view; | 2252 return view; |
2242 } | 2253 } |
2243 #endif | 2254 #endif |
2244 | 2255 |
2245 // static | 2256 // static |
2246 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2257 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
2247 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2258 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
2248 } | 2259 } |
OLD | NEW |