Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 113960: Handle opening URLs when there is no window open.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #import "chrome/browser/app_controller_mac.h" 5 #import "chrome/browser/app_controller_mac.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // the ProcessSingleton, and it calls BrowserInit. It's best to bottleneck the 346 // the ProcessSingleton, and it calls BrowserInit. It's best to bottleneck the
347 // openings through that for uniform handling. 347 // openings through that for uniform handling.
348 348
349 - (void)openURLs:(const std::vector<GURL>&)urls { 349 - (void)openURLs:(const std::vector<GURL>&)urls {
350 if (pendingURLs_.get()) { 350 if (pendingURLs_.get()) {
351 // too early to open; save for later 351 // too early to open; save for later
352 pendingURLs_->insert(pendingURLs_->end(), urls.begin(), urls.end()); 352 pendingURLs_->insert(pendingURLs_->end(), urls.begin(), urls.end());
353 return; 353 return;
354 } 354 }
355 355
356 Browser* browser = BrowserList::GetLastActive();
357 // if no browser window exists then create one with no tabs to be filled in
358 if (!browser) {
359 browser = Browser::Create([self defaultProfile]);
360 browser->window()->Show();
Scott Hess - ex-Googler 2009/05/28 19:34:22 Does the Show() at this point cause any jankiness?
361 }
362
356 CommandLine dummy((std::wstring())); 363 CommandLine dummy((std::wstring()));
357 BrowserInit::LaunchWithProfile launch(std::wstring(), dummy); 364 BrowserInit::LaunchWithProfile launch(std::wstring(), dummy);
358 launch.OpenURLsInBrowser(BrowserList::GetLastActive(), false, urls); 365 launch.OpenURLsInBrowser(browser, false, urls);
359 } 366 }
360 367
361 - (void)openPendingURLs { 368 - (void)openPendingURLs {
362 // Since the existence of pendingURLs_ is a flag that it's too early to 369 // Since the existence of pendingURLs_ is a flag that it's too early to
363 // open URLs, we need to reset pendingURLs_. 370 // open URLs, we need to reset pendingURLs_.
364 std::vector<GURL> urls; 371 std::vector<GURL> urls;
365 swap(urls, *pendingURLs_); 372 swap(urls, *pendingURLs_);
366 pendingURLs_.reset(); 373 pendingURLs_.reset();
367 374
368 if (urls.size()) 375 if (urls.size())
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 name:kUserClosedAboutNotification 484 name:kUserClosedAboutNotification
478 object:aboutController_.get()]; 485 object:aboutController_.get()];
479 } 486 }
480 if (![[aboutController_ window] isVisible]) 487 if (![[aboutController_ window] isVisible])
481 [[aboutController_ window] center]; 488 [[aboutController_ window] center];
482 [aboutController_ showWindow:self]; 489 [aboutController_ showWindow:self];
483 #endif 490 #endif
484 } 491 }
485 492
486 @end 493 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698