Chromium Code Reviews| 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/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
| 8 #include "apps/shell_window_registry.h" | 8 #include "apps/shell_window_registry.h" |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Record the location of the application bundle (containing the main framework) | 160 // Record the location of the application bundle (containing the main framework) |
| 161 // from which Chromium was loaded. This is used by app mode shims to find | 161 // from which Chromium was loaded. This is used by app mode shims to find |
| 162 // Chromium. | 162 // Chromium. |
| 163 void RecordLastRunAppBundlePath() { | 163 void RecordLastRunAppBundlePath() { |
| 164 // Going up three levels from |chrome::GetVersionedDirectory()| gives the | 164 // Going up three levels from |chrome::GetVersionedDirectory()| gives the |
| 165 // real, user-visible app bundle directory. (The alternatives give either the | 165 // real, user-visible app bundle directory. (The alternatives give either the |
| 166 // framework's path or the initial app's path, which may be an app mode shim | 166 // framework's path or the initial app's path, which may be an app mode shim |
| 167 // or a unit test.) | 167 // or a unit test.) |
| 168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | |
| 169 | |
| 168 base::FilePath appBundlePath = | 170 base::FilePath appBundlePath = |
| 169 chrome::GetVersionedDirectory().DirName().DirName().DirName(); | 171 chrome::GetVersionedDirectory().DirName().DirName().DirName(); |
|
tapted
2013/08/22 23:28:04
drive-by: Is there an issue down the code path
Ge
| |
| 170 CFPreferencesSetAppValue( | 172 CFPreferencesSetAppValue( |
| 171 base::mac::NSToCFCast(app_mode::kLastRunAppBundlePathPrefsKey), | 173 base::mac::NSToCFCast(app_mode::kLastRunAppBundlePathPrefsKey), |
| 172 base::SysUTF8ToCFStringRef(appBundlePath.value()), | 174 base::SysUTF8ToCFStringRef(appBundlePath.value()), |
| 173 BaseBundleID_CFString()); | 175 BaseBundleID_CFString()); |
| 174 | 176 |
| 175 // Sync after a delay avoid I/O contention on startup; 1500 ms is plenty. | 177 PrefsSyncCallback(); |
| 176 BrowserThread::PostDelayedTask( | |
| 177 BrowserThread::FILE, FROM_HERE, | |
| 178 base::Bind(&PrefsSyncCallback), | |
| 179 base::TimeDelta::FromMilliseconds(1500)); | |
| 180 } | 178 } |
| 181 | 179 |
| 182 } // anonymous namespace | 180 } // anonymous namespace |
| 183 | 181 |
| 184 @interface AppController (Private) | 182 @interface AppController (Private) |
| 185 - (void)initMenuState; | 183 - (void)initMenuState; |
| 186 - (void)initProfileMenu; | 184 - (void)initProfileMenu; |
| 187 - (void)updateConfirmToQuitPrefMenuItem:(NSMenuItem*)item; | 185 - (void)updateConfirmToQuitPrefMenuItem:(NSMenuItem*)item; |
| 188 - (void)registerServicesMenuTypesTo:(NSApplication*)app; | 186 - (void)registerServicesMenuTypesTo:(NSApplication*)app; |
| 189 - (void)openUrls:(const std::vector<GURL>&)urls; | 187 - (void)openUrls:(const std::vector<GURL>&)urls; |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 // Instantiate the ProfileInfoCache observer so that we can get | 662 // Instantiate the ProfileInfoCache observer so that we can get |
| 665 // notified when a profile is deleted. | 663 // notified when a profile is deleted. |
| 666 profileInfoCacheObserver_.reset(new AppControllerProfileObserver( | 664 profileInfoCacheObserver_.reset(new AppControllerProfileObserver( |
| 667 g_browser_process->profile_manager(), self)); | 665 g_browser_process->profile_manager(), self)); |
| 668 | 666 |
| 669 // Since Chrome is localized to more languages than the OS, tell Cocoa which | 667 // Since Chrome is localized to more languages than the OS, tell Cocoa which |
| 670 // menu is the Help so it can add the search item to it. | 668 // menu is the Help so it can add the search item to it. |
| 671 [NSApp setHelpMenu:helpMenu_]; | 669 [NSApp setHelpMenu:helpMenu_]; |
| 672 | 670 |
| 673 // Record the path to the (browser) app bundle; this is used by the app mode | 671 // Record the path to the (browser) app bundle; this is used by the app mode |
| 674 // shim. | 672 // shim. Sync after a delay avoid I/O contention on startup; 1500 ms is |
| 675 RecordLastRunAppBundlePath(); | 673 // plenty. |
| 674 BrowserThread::PostDelayedTask( | |
| 675 BrowserThread::FILE, FROM_HERE, | |
| 676 base::Bind(&RecordLastRunAppBundlePath), | |
| 677 base::TimeDelta::FromMilliseconds(1500)); | |
| 676 | 678 |
| 677 // Makes "Services" menu items available. | 679 // Makes "Services" menu items available. |
| 678 [self registerServicesMenuTypesTo:[notify object]]; | 680 [self registerServicesMenuTypesTo:[notify object]]; |
| 679 | 681 |
| 680 startupComplete_ = YES; | 682 startupComplete_ = YES; |
| 681 | 683 |
| 682 // TODO(viettrungluu): This is very temporary, since this should be done "in" | 684 // TODO(viettrungluu): This is very temporary, since this should be done "in" |
| 683 // |BrowserMain()|, i.e., this list of startup URLs should be appended to the | 685 // |BrowserMain()|, i.e., this list of startup URLs should be appended to the |
| 684 // (probably-empty) list of URLs from the command line. | 686 // (probably-empty) list of URLs from the command line. |
| 685 if (startupUrls_.size()) { | 687 if (startupUrls_.size()) { |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1418 | 1420 |
| 1419 //--------------------------------------------------------------------------- | 1421 //--------------------------------------------------------------------------- |
| 1420 | 1422 |
| 1421 namespace app_controller_mac { | 1423 namespace app_controller_mac { |
| 1422 | 1424 |
| 1423 bool IsOpeningNewWindow() { | 1425 bool IsOpeningNewWindow() { |
| 1424 return g_is_opening_new_window; | 1426 return g_is_opening_new_window; |
| 1425 } | 1427 } |
| 1426 | 1428 |
| 1427 } // namespace app_controller_mac | 1429 } // namespace app_controller_mac |
| OLD | NEW |