| 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 "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 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 TabContents* new_contents, | 1428 TabContents* new_contents, |
| 1429 int index, | 1429 int index, |
| 1430 bool user_gesture) { | 1430 bool user_gesture) { |
| 1431 DCHECK(old_contents != new_contents); | 1431 DCHECK(old_contents != new_contents); |
| 1432 | 1432 |
| 1433 // If we have any update pending, do it now. | 1433 // If we have any update pending, do it now. |
| 1434 if (!chrome_updater_factory_.empty() && old_contents) | 1434 if (!chrome_updater_factory_.empty() && old_contents) |
| 1435 ProcessPendingUIUpdates(); | 1435 ProcessPendingUIUpdates(); |
| 1436 | 1436 |
| 1437 if (old_contents) { | 1437 if (old_contents) { |
| 1438 #if defined(OS_WIN) |
| 1438 // Save what the user's currently typing, so it can be restored when we | 1439 // Save what the user's currently typing, so it can be restored when we |
| 1439 // switch back to this tab. | 1440 // switch back to this tab. |
| 1440 window_->GetLocationBar()->SaveStateToContents(old_contents); | 1441 window_->GetLocationBar()->SaveStateToContents(old_contents); |
| 1442 #else |
| 1443 NOTIMPLEMENTED(); |
| 1444 #endif |
| 1441 } | 1445 } |
| 1442 | 1446 |
| 1443 // Propagate the profile to the location bar. | 1447 // Propagate the profile to the location bar. |
| 1444 UpdateToolbar(true); | 1448 UpdateToolbar(true); |
| 1445 | 1449 |
| 1446 // Update stop/go state. | 1450 // Update stop/go state. |
| 1447 UpdateStopGoState(new_contents->is_loading()); | 1451 UpdateStopGoState(new_contents->is_loading()); |
| 1448 | 1452 |
| 1449 // Update commands to reflect current state. | 1453 // Update commands to reflect current state. |
| 1450 UpdateCommandsForTabState(); | 1454 UpdateCommandsForTabState(); |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2370 // it (via BrowserView::TabSelectedAt calling RestoreFocus), triggering any | 2374 // it (via BrowserView::TabSelectedAt calling RestoreFocus), triggering any |
| 2371 // onblur="" handlers. | 2375 // onblur="" handlers. |
| 2372 browser->window()->Show(); | 2376 browser->window()->Show(); |
| 2373 // TODO(beng): See if this can be made to use | 2377 // TODO(beng): See if this can be made to use |
| 2374 // TabStripModel::AppendTabContents. | 2378 // TabStripModel::AppendTabContents. |
| 2375 browser->AddNewContents(source, new_contents, NEW_FOREGROUND_TAB, | 2379 browser->AddNewContents(source, new_contents, NEW_FOREGROUND_TAB, |
| 2376 gfx::Rect(), true); | 2380 gfx::Rect(), true); |
| 2377 } | 2381 } |
| 2378 | 2382 |
| 2379 GURL Browser::GetHomePage() { | 2383 GURL Browser::GetHomePage() { |
| 2384 #if defined(OS_LINUX) |
| 2385 return GURL("about:linux-splash"); |
| 2386 #endif |
| 2380 if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) | 2387 if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) |
| 2381 return NewTabUI::GetBaseURL(); | 2388 return NewTabUI::GetBaseURL(); |
| 2382 GURL home_page = GURL(URLFixerUpper::FixupURL( | 2389 GURL home_page = GURL(URLFixerUpper::FixupURL( |
| 2383 WideToUTF8(profile_->GetPrefs()->GetString(prefs::kHomePage)), | 2390 WideToUTF8(profile_->GetPrefs()->GetString(prefs::kHomePage)), |
| 2384 std::string())); | 2391 std::string())); |
| 2385 if (!home_page.is_valid()) | 2392 if (!home_page.is_valid()) |
| 2386 return NewTabUI::GetBaseURL(); | 2393 return NewTabUI::GetBaseURL(); |
| 2387 return home_page; | 2394 return home_page; |
| 2388 } | 2395 } |
| 2389 | 2396 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 | 2433 |
| 2427 // We need to register the window position pref. | 2434 // We need to register the window position pref. |
| 2428 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2435 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
| 2429 window_pref.append(L"_"); | 2436 window_pref.append(L"_"); |
| 2430 window_pref.append(app_name); | 2437 window_pref.append(app_name); |
| 2431 PrefService* prefs = g_browser_process->local_state(); | 2438 PrefService* prefs = g_browser_process->local_state(); |
| 2432 DCHECK(prefs); | 2439 DCHECK(prefs); |
| 2433 | 2440 |
| 2434 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2441 prefs->RegisterDictionaryPref(window_pref.c_str()); |
| 2435 } | 2442 } |
| OLD | NEW |