OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |