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/sessions/session_restore.h" | 5 #include "chrome/browser/sessions/session_restore.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 browser->GetSelectedTabContents()->view()->SetInitialFocus(); | 358 browser->GetSelectedTabContents()->view()->SetInitialFocus(); |
359 } | 359 } |
360 | 360 |
361 // Appends the urls in |urls| to |browser|. If |pin_tabs| is true the first n | 361 // Appends the urls in |urls| to |browser|. If |pin_tabs| is true the first n |
362 // tabs are pinned, where n is the command line value for --pinned-tab-count. | 362 // tabs are pinned, where n is the command line value for --pinned-tab-count. |
363 void AppendURLsToBrowser(Browser* browser, | 363 void AppendURLsToBrowser(Browser* browser, |
364 const std::vector<GURL>& urls, | 364 const std::vector<GURL>& urls, |
365 bool pin_tabs) { | 365 bool pin_tabs) { |
366 int pin_count = 0; | 366 int pin_count = 0; |
367 if (pin_tabs) { | 367 if (pin_tabs) { |
368 std::wstring pin_count_string = | 368 std::string pin_count_string = |
369 CommandLine::ForCurrentProcess()->GetSwitchValue( | 369 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
370 switches::kPinnedTabCount); | 370 switches::kPinnedTabCount); |
371 if (!pin_count_string.empty()) | 371 if (!pin_count_string.empty()) |
372 pin_count = StringToInt(WideToUTF16Hack(pin_count_string)); | 372 pin_count = StringToInt(pin_count_string); |
373 } | 373 } |
374 | 374 |
375 for (size_t i = 0; i < urls.size(); ++i) { | 375 for (size_t i = 0; i < urls.size(); ++i) { |
376 browser->AddTabWithURL(urls[i], GURL(), PageTransition::START_PAGE, | 376 browser->AddTabWithURL(urls[i], GURL(), PageTransition::START_PAGE, |
377 (i == 0), -1, false, NULL); | 377 (i == 0), -1, false, NULL); |
378 if (i < static_cast<size_t>(pin_count)) { | 378 if (i < static_cast<size_t>(pin_count)) { |
379 browser->tabstrip_model()->SetTabPinned(browser->tab_count() - 1, | 379 browser->tabstrip_model()->SetTabPinned(browser->tab_count() - 1, |
380 true); | 380 true); |
381 } | 381 } |
382 } | 382 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 Restore(profile, browser, false, clobber_existing_window, | 459 Restore(profile, browser, false, clobber_existing_window, |
460 always_create_tabbed_browser, urls_to_open); | 460 always_create_tabbed_browser, urls_to_open); |
461 } | 461 } |
462 | 462 |
463 // static | 463 // static |
464 void SessionRestore::RestoreSessionSynchronously( | 464 void SessionRestore::RestoreSessionSynchronously( |
465 Profile* profile, | 465 Profile* profile, |
466 const std::vector<GURL>& urls_to_open) { | 466 const std::vector<GURL>& urls_to_open) { |
467 Restore(profile, NULL, true, false, true, urls_to_open); | 467 Restore(profile, NULL, true, false, true, urls_to_open); |
468 } | 468 } |
OLD | NEW |