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

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

Issue 240273002: Close the ntp during startup when opening a link on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
« 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "apps/app_shim/app_shim_mac.h" 7 #include "apps/app_shim/app_shim_mac.h"
8 #include "apps/app_shim/extension_app_shim_handler_mac.h" 8 #include "apps/app_shim/extension_app_shim_handler_mac.h"
9 #include "apps/app_window_registry.h" 9 #include "apps/app_window_registry.h"
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 722
723 // Makes "Services" menu items available. 723 // Makes "Services" menu items available.
724 [self registerServicesMenuTypesTo:[notify object]]; 724 [self registerServicesMenuTypesTo:[notify object]];
725 725
726 startupComplete_ = YES; 726 startupComplete_ = YES;
727 727
728 // TODO(viettrungluu): This is very temporary, since this should be done "in" 728 // TODO(viettrungluu): This is very temporary, since this should be done "in"
729 // |BrowserMain()|, i.e., this list of startup URLs should be appended to the 729 // |BrowserMain()|, i.e., this list of startup URLs should be appended to the
730 // (probably-empty) list of URLs from the command line. 730 // (probably-empty) list of URLs from the command line.
731 if (startupUrls_.size()) { 731 if (startupUrls_.size()) {
732 // The browser is already loaded at this point with the new tab page.
Alexei Svitkine (slow) 2014/04/16 14:35:30 Could you make a new method wrapping all of this l
733 int ntp_index;
Alexei Svitkine (slow) 2014/04/16 14:35:30 Nit: Init this to a dummy value.
734 Browser* browser = chrome::GetLastActiveBrowser();
735 if (browser) {
736 DCHECK(browser->tab_strip_model()->count() == 1);
Alexei Svitkine (slow) 2014/04/16 14:35:30 DCHECK_EQ? Also, are you sure this will always be
737 ntp_index = browser->tab_strip_model()->active_index();
738 }
739
732 [self openUrls:startupUrls_]; 740 [self openUrls:startupUrls_];
733 [self clearStartupUrls]; 741 [self clearStartupUrls];
742
743 // Close the new tab page after opening urls to prevent from closing the
Alexei Svitkine (slow) 2014/04/16 14:35:30 Nit: Remove "from".
744 // browser window.
745 if (browser)
Alexei Svitkine (slow) 2014/04/16 14:35:30 Nit: add {}'s
746 browser->tab_strip_model()->CloseWebContentsAt(ntp_index,
747 TabStripModel::CLOSE_NONE);
734 } 748 }
735 749
736 PrefService* localState = g_browser_process->local_state(); 750 PrefService* localState = g_browser_process->local_state();
737 if (localState) { 751 if (localState) {
738 localPrefRegistrar_.Init(localState); 752 localPrefRegistrar_.Init(localState);
739 localPrefRegistrar_.Add( 753 localPrefRegistrar_.Add(
740 prefs::kAllowFileSelectionDialogs, 754 prefs::kAllowFileSelectionDialogs,
741 base::Bind(&chrome::BrowserCommandController::UpdateOpenFileState, 755 base::Bind(&chrome::BrowserCommandController::UpdateOpenFileState,
742 menuState_.get())); 756 menuState_.get()));
743 } 757 }
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 1509
1496 //--------------------------------------------------------------------------- 1510 //---------------------------------------------------------------------------
1497 1511
1498 namespace app_controller_mac { 1512 namespace app_controller_mac {
1499 1513
1500 bool IsOpeningNewWindow() { 1514 bool IsOpeningNewWindow() {
1501 return g_is_opening_new_window; 1515 return g_is_opening_new_window;
1502 } 1516 }
1503 1517
1504 } // namespace app_controller_mac 1518 } // namespace app_controller_mac
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