| 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_init.h" | 5 #include "chrome/browser/browser_init.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include "app/win_util.h" | 8 #include "app/win_util.h" |
| 9 #endif | 9 #endif |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 return in_startup; | 370 return in_startup; |
| 371 } | 371 } |
| 372 | 372 |
| 373 // LaunchWithProfile ---------------------------------------------------------- | 373 // LaunchWithProfile ---------------------------------------------------------- |
| 374 | 374 |
| 375 BrowserInit::LaunchWithProfile::LaunchWithProfile( | 375 BrowserInit::LaunchWithProfile::LaunchWithProfile( |
| 376 const std::wstring& cur_dir, | 376 const std::wstring& cur_dir, |
| 377 const CommandLine& command_line) | 377 const CommandLine& command_line) |
| 378 : cur_dir_(cur_dir), | 378 : cur_dir_(cur_dir), |
| 379 command_line_(command_line), | 379 command_line_(command_line), |
| 380 profile_(NULL), |
| 380 browser_init_(NULL) { | 381 browser_init_(NULL) { |
| 381 } | 382 } |
| 382 | 383 |
| 383 BrowserInit::LaunchWithProfile::LaunchWithProfile( | 384 BrowserInit::LaunchWithProfile::LaunchWithProfile( |
| 384 const std::wstring& cur_dir, | 385 const std::wstring& cur_dir, |
| 385 const CommandLine& command_line, | 386 const CommandLine& command_line, |
| 386 BrowserInit* browser_init) | 387 BrowserInit* browser_init) |
| 387 : cur_dir_(cur_dir), | 388 : cur_dir_(cur_dir), |
| 388 command_line_(command_line), | 389 command_line_(command_line), |
| 390 profile_(NULL), |
| 389 browser_init_(browser_init) { | 391 browser_init_(browser_init) { |
| 390 } | 392 } |
| 391 | 393 |
| 392 bool BrowserInit::LaunchWithProfile::Launch(Profile* profile, | 394 bool BrowserInit::LaunchWithProfile::Launch(Profile* profile, |
| 393 bool process_startup) { | 395 bool process_startup) { |
| 394 DCHECK(profile); | 396 DCHECK(profile); |
| 395 profile_ = profile; | 397 profile_ = profile; |
| 396 | 398 |
| 397 if (command_line_.HasSwitch(switches::kDnsLogDetails)) | 399 if (command_line_.HasSwitch(switches::kDnsLogDetails)) |
| 398 chrome_browser_net::EnableDnsDetailedLog(true); | 400 chrome_browser_net::EnableDnsDetailedLog(true); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 default: | 549 default: |
| 548 return false; | 550 return false; |
| 549 } | 551 } |
| 550 } | 552 } |
| 551 | 553 |
| 552 Browser* BrowserInit::LaunchWithProfile::OpenURLsInBrowser( | 554 Browser* BrowserInit::LaunchWithProfile::OpenURLsInBrowser( |
| 553 Browser* browser, | 555 Browser* browser, |
| 554 bool process_startup, | 556 bool process_startup, |
| 555 const std::vector<GURL>& urls) { | 557 const std::vector<GURL>& urls) { |
| 556 DCHECK(!urls.empty()); | 558 DCHECK(!urls.empty()); |
| 559 // If we don't yet have a profile, try to use the one we're given from |
| 560 // |browser|. While we may not end up actually using |browser| (since it |
| 561 // could be a popup window), we can at least use the profile. |
| 562 if (!profile_ && browser) |
| 563 profile_ = browser->profile(); |
| 564 |
| 557 int pin_count = 0; | 565 int pin_count = 0; |
| 558 if (!browser) { | 566 if (!browser) { |
| 559 std::wstring pin_count_string = | 567 std::wstring pin_count_string = |
| 560 command_line_.GetSwitchValue(switches::kPinnedTabCount); | 568 command_line_.GetSwitchValue(switches::kPinnedTabCount); |
| 561 if (!pin_count_string.empty()) | 569 if (!pin_count_string.empty()) |
| 562 pin_count = StringToInt(WideToUTF16Hack(pin_count_string)); | 570 pin_count = StringToInt(WideToUTF16Hack(pin_count_string)); |
| 563 } | 571 } |
| 564 if (!browser || browser->type() != Browser::TYPE_NORMAL) | 572 if (!browser || browser->type() != Browser::TYPE_NORMAL) |
| 565 browser = Browser::Create(profile_); | 573 browser = Browser::Create(profile_); |
| 566 | 574 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 scoped_refptr<AutomationProviderClass> automation = | 840 scoped_refptr<AutomationProviderClass> automation = |
| 833 new AutomationProviderClass(profile); | 841 new AutomationProviderClass(profile); |
| 834 automation->ConnectToChannel(channel_id); | 842 automation->ConnectToChannel(channel_id); |
| 835 automation->SetExpectedTabCount(expected_tabs); | 843 automation->SetExpectedTabCount(expected_tabs); |
| 836 | 844 |
| 837 AutomationProviderList* list = | 845 AutomationProviderList* list = |
| 838 g_browser_process->InitAutomationProviderList(); | 846 g_browser_process->InitAutomationProviderList(); |
| 839 DCHECK(list); | 847 DCHECK(list); |
| 840 list->AddProvider(automation); | 848 list->AddProvider(automation); |
| 841 } | 849 } |
| OLD | NEW |