| Index: chrome/browser/browser_init.cc
|
| ===================================================================
|
| --- chrome/browser/browser_init.cc (revision 22086)
|
| +++ chrome/browser/browser_init.cc (working copy)
|
| @@ -377,6 +377,7 @@
|
| const CommandLine& command_line)
|
| : cur_dir_(cur_dir),
|
| command_line_(command_line),
|
| + profile_(NULL),
|
| browser_init_(NULL) {
|
| }
|
|
|
| @@ -386,6 +387,7 @@
|
| BrowserInit* browser_init)
|
| : cur_dir_(cur_dir),
|
| command_line_(command_line),
|
| + profile_(NULL),
|
| browser_init_(browser_init) {
|
| }
|
|
|
| @@ -554,6 +556,12 @@
|
| bool process_startup,
|
| const std::vector<GURL>& urls) {
|
| DCHECK(!urls.empty());
|
| + // If we don't yet have a profile, try to use the one we're given from
|
| + // |browser|. While we may not end up actually using |browser| (since it
|
| + // could be a popup window), we can at least use the profile.
|
| + if (!profile_ && browser)
|
| + profile_ = browser->profile();
|
| +
|
| int pin_count = 0;
|
| if (!browser) {
|
| std::wstring pin_count_string =
|
| @@ -561,9 +569,13 @@
|
| if (!pin_count_string.empty())
|
| pin_count = StringToInt(WideToUTF16Hack(pin_count_string));
|
| }
|
| - if (!browser || browser->type() != Browser::TYPE_NORMAL)
|
| - browser = Browser::Create(profile_);
|
| -
|
| + if (!browser || browser->type() != Browser::TYPE_NORMAL) {
|
| + // Try to find an existing "normal" browser. If one does not exist, create
|
| + // one.
|
| + browser = BrowserList::FindBrowserWithType(profile_, Browser::TYPE_NORMAL);
|
| + if (!browser || !browser->GetSelectedTabContents())
|
| + browser = Browser::Create(profile_);
|
| + }
|
| for (size_t i = 0; i < urls.size(); ++i) {
|
| TabContents* tab = browser->AddTabWithURL(
|
| urls[i], GURL(), PageTransition::START_PAGE, (i == 0), -1, false, NULL);
|
|
|