| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 PrefService* local_state = g_browser_process->local_state(); | 275 PrefService* local_state = g_browser_process->local_state(); |
| 276 if (!local_state) | 276 if (!local_state) |
| 277 return; | 277 return; |
| 278 if (local_state->IsPrefRegistered(prefs::kShouldShowFirstRunBubble) && | 278 if (local_state->IsPrefRegistered(prefs::kShouldShowFirstRunBubble) && |
| 279 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { | 279 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { |
| 280 // Reset the preference so we don't show the bubble for subsequent windows. | 280 // Reset the preference so we don't show the bubble for subsequent windows. |
| 281 local_state->ClearPref(prefs::kShouldShowFirstRunBubble); | 281 local_state->ClearPref(prefs::kShouldShowFirstRunBubble); |
| 282 window_->GetLocationBar()->ShowFirstRunBubble(); | 282 window_->GetLocationBar()->ShowFirstRunBubble(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 #if defined(OS_WIN) | 285 #if defined(OS_WIN) |
| 286 FindBar* find_bar = BrowserWindow::CreateFindBar(this); | 286 FindBar* find_bar = BrowserWindow::CreateFindBar(this); |
| 287 find_bar_controller_.reset(new FindBarController(find_bar)); | 287 find_bar_controller_.reset(new FindBarController(find_bar)); |
| 288 find_bar->SetFindBarController(find_bar_controller_.get()); | 288 find_bar->SetFindBarController(find_bar_controller_.get()); |
| 289 #endif | 289 #endif |
| 290 } | 290 } |
| 291 | 291 |
| 292 /////////////////////////////////////////////////////////////////////////////// | 292 /////////////////////////////////////////////////////////////////////////////// |
| 293 // Browser, Creation Helpers: | 293 // Browser, Creation Helpers: |
| 294 | 294 |
| 295 // static | 295 // static |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 | 1343 |
| 1344 TabContents* Browser::CreateTabContentsForURL( | 1344 TabContents* Browser::CreateTabContentsForURL( |
| 1345 const GURL& url, const GURL& referrer, Profile* profile, | 1345 const GURL& url, const GURL& referrer, Profile* profile, |
| 1346 PageTransition::Type transition, bool defer_load, | 1346 PageTransition::Type transition, bool defer_load, |
| 1347 SiteInstance* instance) const { | 1347 SiteInstance* instance) const { |
| 1348 // Create an appropriate tab contents. | 1348 // Create an appropriate tab contents. |
| 1349 GURL real_url = url; | 1349 GURL real_url = url; |
| 1350 TabContentsType type = TabContents::TypeForURL(&real_url); | 1350 TabContentsType type = TabContents::TypeForURL(&real_url); |
| 1351 DCHECK(type != TAB_CONTENTS_UNKNOWN_TYPE); | 1351 DCHECK(type != TAB_CONTENTS_UNKNOWN_TYPE); |
| 1352 | 1352 |
| 1353 TabContents* contents = TabContents::CreateWithType(type, profile, instance, | 1353 TabContents* contents = TabContents::CreateWithType(type, profile, instance); |
| 1354 NULL); | |
| 1355 contents->SetupController(profile); | 1354 contents->SetupController(profile); |
| 1356 | 1355 |
| 1357 if (!defer_load) { | 1356 if (!defer_load) { |
| 1358 // Load the initial URL before adding the new tab contents to the tab strip | 1357 // Load the initial URL before adding the new tab contents to the tab strip |
| 1359 // so that the tab contents has navigation state. | 1358 // so that the tab contents has navigation state. |
| 1360 contents->controller()->LoadURL(url, referrer, transition); | 1359 contents->controller()->LoadURL(url, referrer, transition); |
| 1361 } | 1360 } |
| 1362 | 1361 |
| 1363 return contents; | 1362 return contents; |
| 1364 } | 1363 } |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2379 } | 2378 } |
| 2380 | 2379 |
| 2381 NavigationController* Browser::BuildRestoredNavigationController( | 2380 NavigationController* Browser::BuildRestoredNavigationController( |
| 2382 const std::vector<TabNavigation>& navigations, | 2381 const std::vector<TabNavigation>& navigations, |
| 2383 int selected_navigation) { | 2382 int selected_navigation) { |
| 2384 if (!navigations.empty()) { | 2383 if (!navigations.empty()) { |
| 2385 DCHECK(selected_navigation >= 0 && | 2384 DCHECK(selected_navigation >= 0 && |
| 2386 selected_navigation < static_cast<int>(navigations.size())); | 2385 selected_navigation < static_cast<int>(navigations.size())); |
| 2387 // Create a NavigationController. This constructor creates the appropriate | 2386 // Create a NavigationController. This constructor creates the appropriate |
| 2388 // set of TabContents. | 2387 // set of TabContents. |
| 2389 return new NavigationController(profile_, navigations, selected_navigation, | 2388 return new NavigationController(profile_, navigations, selected_navigation); |
| 2390 NULL); | |
| 2391 } else { | 2389 } else { |
| 2392 // No navigations. Create a tab with about:blank. | 2390 // No navigations. Create a tab with about:blank. |
| 2393 TabContents* contents = | 2391 TabContents* contents = |
| 2394 CreateTabContentsForURL(GURL("about:blank"), GURL(), profile_, | 2392 CreateTabContentsForURL(GURL("about:blank"), GURL(), profile_, |
| 2395 PageTransition::START_PAGE, false, NULL); | 2393 PageTransition::START_PAGE, false, NULL); |
| 2396 return new NavigationController(contents, profile_); | 2394 return new NavigationController(contents, profile_); |
| 2397 } | 2395 } |
| 2398 } | 2396 } |
| 2399 | 2397 |
| 2400 /////////////////////////////////////////////////////////////////////////////// | 2398 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2544 | 2542 |
| 2545 // We need to register the window position pref. | 2543 // We need to register the window position pref. |
| 2546 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2544 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
| 2547 window_pref.append(L"_"); | 2545 window_pref.append(L"_"); |
| 2548 window_pref.append(app_name); | 2546 window_pref.append(app_name); |
| 2549 PrefService* prefs = g_browser_process->local_state(); | 2547 PrefService* prefs = g_browser_process->local_state(); |
| 2550 DCHECK(prefs); | 2548 DCHECK(prefs); |
| 2551 | 2549 |
| 2552 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2550 prefs->RegisterDictionaryPref(window_pref.c_str()); |
| 2553 } | 2551 } |
| OLD | NEW |