| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 TabContents* selected_tab_contents = GetSelectedTabContents(); | 845 TabContents* selected_tab_contents = GetSelectedTabContents(); |
| 846 if (selected_tab_contents) | 846 if (selected_tab_contents) |
| 847 selected_tab_contents->view()->RestoreFocus(); | 847 selected_tab_contents->view()->RestoreFocus(); |
| 848 } | 848 } |
| 849 | 849 |
| 850 LocationBar* BrowserView::GetLocationBar() const { | 850 LocationBar* BrowserView::GetLocationBar() const { |
| 851 return GetLocationBarView(); | 851 return GetLocationBarView(); |
| 852 } | 852 } |
| 853 | 853 |
| 854 void BrowserView::SetFocusToLocationBar(bool select_all) { | 854 void BrowserView::SetFocusToLocationBar(bool select_all) { |
| 855 // Only change focus if this is the active window otherwise we'll end |
| 856 // accidentally deactivating another window. |
| 857 if (!IsActive()) |
| 858 return; |
| 859 |
| 855 if (UseCompactNavigationBar()) { | 860 if (UseCompactNavigationBar()) { |
| 856 // If focus ever goes to the location bar, we should make sure it is shown | 861 // If focus ever goes to the location bar, we should make sure it is shown |
| 857 // in compact mode. This includes all accelerators that move focus there. | 862 // in compact mode. This includes all accelerators that move focus there. |
| 858 ShowCompactLocationBarUnderSelectedTab(); | 863 ShowCompactLocationBarUnderSelectedTab(); |
| 859 } | 864 } |
| 860 LocationBarView* location_bar = GetLocationBarView(); | 865 LocationBarView* location_bar = GetLocationBarView(); |
| 861 if (location_bar->IsFocusableInRootView()) { | 866 if (location_bar->IsFocusableInRootView()) { |
| 862 // Location bar got focus. | 867 // Location bar got focus. |
| 863 location_bar->FocusLocation(select_all); | 868 location_bar->FocusLocation(select_all); |
| 864 } else { | 869 } else { |
| (...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2713 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2709 // Create the view and the frame. The frame will attach itself via the view | 2714 // Create the view and the frame. The frame will attach itself via the view |
| 2710 // so we don't need to do anything with the pointer. | 2715 // so we don't need to do anything with the pointer. |
| 2711 BrowserView* view = new BrowserView(browser); | 2716 BrowserView* view = new BrowserView(browser); |
| 2712 (new BrowserFrame(view))->InitBrowserFrame(); | 2717 (new BrowserFrame(view))->InitBrowserFrame(); |
| 2713 view->GetWidget()->non_client_view()->SetAccessibleName( | 2718 view->GetWidget()->non_client_view()->SetAccessibleName( |
| 2714 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2719 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 2715 return view; | 2720 return view; |
| 2716 } | 2721 } |
| 2717 #endif | 2722 #endif |
| OLD | NEW |