OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/browser.h" | 5 #include "chrome/browser/browser.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/idle_timer.h" | 8 #include "base/idle_timer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2594 Browser::Type browser_type, | 2594 Browser::Type browser_type, |
2595 Profile* profile, | 2595 Profile* profile, |
2596 bool start_restored) { | 2596 bool start_restored) { |
2597 Browser* browser = new Browser(browser_type, profile); | 2597 Browser* browser = new Browser(browser_type, profile); |
2598 browser->set_override_bounds(initial_pos); | 2598 browser->set_override_bounds(initial_pos); |
2599 | 2599 |
2600 if (start_restored) | 2600 if (start_restored) |
2601 browser->set_maximized_state(MAXIMIZED_STATE_UNMAXIMIZED); | 2601 browser->set_maximized_state(MAXIMIZED_STATE_UNMAXIMIZED); |
2602 | 2602 |
2603 browser->CreateBrowserWindow(); | 2603 browser->CreateBrowserWindow(); |
2604 // We need to Show before AddNewContents, otherwise AddNewContents will focus | 2604 browser->tabstrip_model()->AppendTabContents(new_contents, true); |
2605 // it (via BrowserView::TabSelectedAt calling RestoreFocus), triggering any | |
2606 // onblur="" handlers. | |
2607 browser->window()->Show(); | 2605 browser->window()->Show(); |
2608 | |
2609 // TODO(beng): See if this can be made to use | |
2610 // TabStripModel::AppendTabContents. | |
2611 browser->AddNewContents(source, new_contents, NEW_FOREGROUND_TAB, | |
2612 gfx::Rect(), true); | |
2613 } | 2606 } |
2614 | 2607 |
2615 GURL Browser::GetHomePage() const { | 2608 GURL Browser::GetHomePage() const { |
2616 if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) | 2609 if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) |
2617 return GURL(chrome::kChromeUINewTabURL); | 2610 return GURL(chrome::kChromeUINewTabURL); |
2618 GURL home_page = GURL(URLFixerUpper::FixupURL( | 2611 GURL home_page = GURL(URLFixerUpper::FixupURL( |
2619 WideToUTF8(profile_->GetPrefs()->GetString(prefs::kHomePage)), | 2612 WideToUTF8(profile_->GetPrefs()->GetString(prefs::kHomePage)), |
2620 std::string())); | 2613 std::string())); |
2621 if (!home_page.is_valid()) | 2614 if (!home_page.is_valid()) |
2622 return GURL(chrome::kChromeUINewTabURL); | 2615 return GURL(chrome::kChromeUINewTabURL); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2660 | 2653 |
2661 // We need to register the window position pref. | 2654 // We need to register the window position pref. |
2662 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2655 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
2663 window_pref.append(L"_"); | 2656 window_pref.append(L"_"); |
2664 window_pref.append(app_name); | 2657 window_pref.append(app_name); |
2665 PrefService* prefs = g_browser_process->local_state(); | 2658 PrefService* prefs = g_browser_process->local_state(); |
2666 DCHECK(prefs); | 2659 DCHECK(prefs); |
2667 | 2660 |
2668 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2661 prefs->RegisterDictionaryPref(window_pref.c_str()); |
2669 } | 2662 } |
OLD | NEW |