OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <windows.h> | 5 #include <windows.h> |
6 #include <shellapi.h> | 6 #include <shellapi.h> |
7 | 7 |
8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 } | 650 } |
651 | 651 |
652 void Browser::NewTab() { | 652 void Browser::NewTab() { |
653 UserMetrics::RecordAction(L"NewTab", profile_); | 653 UserMetrics::RecordAction(L"NewTab", profile_); |
654 if (type() == TYPE_NORMAL) { | 654 if (type() == TYPE_NORMAL) { |
655 AddBlankTab(true); | 655 AddBlankTab(true); |
656 } else { | 656 } else { |
657 Browser* b = GetOrCreateTabbedBrowser(); | 657 Browser* b = GetOrCreateTabbedBrowser(); |
658 b->AddBlankTab(true); | 658 b->AddBlankTab(true); |
659 b->window()->Show(); | 659 b->window()->Show(); |
| 660 // The call to AddBlankTab above did not set the focus to the tab as its |
| 661 // window was not active, so we have to do it explicitly. |
| 662 // See http://crbug.com/6380. |
| 663 TabContents* tab = b->GetSelectedTabContents(); |
| 664 tab->RestoreFocus(); |
660 } | 665 } |
661 } | 666 } |
662 | 667 |
663 void Browser::CloseTab() { | 668 void Browser::CloseTab() { |
664 UserMetrics::RecordAction(L"CloseTab_Accelerator", profile_); | 669 UserMetrics::RecordAction(L"CloseTab_Accelerator", profile_); |
665 tabstrip_model_.CloseTabContentsAt(tabstrip_model_.selected_index()); | 670 tabstrip_model_.CloseTabContentsAt(tabstrip_model_.selected_index()); |
666 } | 671 } |
667 | 672 |
668 void Browser::SelectNextTab() { | 673 void Browser::SelectNextTab() { |
669 UserMetrics::RecordAction(L"SelectNextTab", profile_); | 674 UserMetrics::RecordAction(L"SelectNextTab", profile_); |
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2383 | 2388 |
2384 // We need to register the window position pref. | 2389 // We need to register the window position pref. |
2385 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2390 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
2386 window_pref.append(L"_"); | 2391 window_pref.append(L"_"); |
2387 window_pref.append(app_name); | 2392 window_pref.append(app_name); |
2388 PrefService* prefs = g_browser_process->local_state(); | 2393 PrefService* prefs = g_browser_process->local_state(); |
2389 DCHECK(prefs); | 2394 DCHECK(prefs); |
2390 | 2395 |
2391 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2396 prefs->RegisterDictionaryPref(window_pref.c_str()); |
2392 } | 2397 } |
OLD | NEW |