summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chrome_browser_main_mac.mm
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-24 03:47:59 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-24 03:47:59 +0000
commit1dd17d77d24a3232976e03b3ec5c7c61a14f1015 (patch)
tree1908be9b6513b74a7b90b1d45b98a2827efa5d12 /chrome/browser/chrome_browser_main_mac.mm
parent051b520a6c03a0bbb1e6385cff114411296b52d1 (diff)
downloadchromium_src-1dd17d77d24a3232976e03b3ec5c7c61a14f1015.zip
chromium_src-1dd17d77d24a3232976e03b3ec5c7c61a14f1015.tar.gz
chromium_src-1dd17d77d24a3232976e03b3ec5c7c61a14f1015.tar.bz2
Fix install-from-dmg.
When installing from a disk image, the browser relaunched from the newly-installed location should follow the proper first-run experience if appropriate. When installing from a disk image, existing dock tiles should be reused, and dock tiles pointing at the application on the disk image should be replaced with ones pointing at the newly-installed location. When installing from a disk image and requesting administrator access (because the user does not have permission to install to /Applications), Keystone should be promoted to a system-level install, and Chrome's Keystone ticket should be promoted to a system Keystone ticket. The custom panel key window tracking stuff doesn't need to maintain strong references to key windows, but does need to be beefed up for thread safety. Chrome doesn't need to wait until it's mostly started up to run the install-from-dmg flow. It should do it early, avoiding delays and reducing the possibility that harmful services will start running. BUG=119325 TEST=obvious from the above and the bug Review URL: http://codereview.chromium.org/9814029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_browser_main_mac.mm')
-rw-r--r--chrome/browser/chrome_browser_main_mac.mm29
1 files changed, 25 insertions, 4 deletions
diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm
index 493f8ea..8264490 100644
--- a/chrome/browser/chrome_browser_main_mac.mm
+++ b/chrome/browser/chrome_browser_main_mac.mm
@@ -16,6 +16,7 @@
#include "chrome/app/breakpad_mac.h"
#import "chrome/browser/app_controller_mac.h"
#import "chrome/browser/chrome_browser_application_mac.h"
+#include "chrome/browser/mac/install_from_dmg.h"
#import "chrome/browser/mac/keystone_glue.h"
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/common/chrome_paths.h"
@@ -94,6 +95,30 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() {
ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
}
+ // This is a no-op if the KeystoneRegistration framework is not present.
+ // The framework is only distributed with branded Google Chrome builds.
+ [[KeystoneGlue defaultKeystoneGlue] registerWithKeystone];
+
+ // Disk image installation is sort of a first-run task, so it shares the
+ // kNoFirstRun switch.
+ //
+ // This needs to be done after the resource bundle is initialized (for
+ // access to localizations in the UI) and after Keystone is initialized
+ // (because the installation may need to promote Keystone) but before the
+ // app controller is set up (and thus before MainMenu.nib is loaded, because
+ // the app controller assumes that a browser has been set up and will crash
+ // upon receipt of certain notifications if no browser exists), before
+ // anyone tries doing anything silly like firing off an import job, and
+ // before anything creating preferences like Local State in order for the
+ // relaunched installed application to still consider itself as first-run.
+ if (!parsed_command_line().HasSwitch(switches::kNoFirstRun)) {
+ if (MaybeInstallFromDiskImage()) {
+ // The application was installed and the installed copy has been
+ // launched. This process is now obsolete. Exit.
+ exit(0);
+ }
+ }
+
// Now load the nib (from the right bundle).
scoped_nsobject<NSNib>
nib([[NSNib alloc] initWithNibNamed:@"MainMenu"
@@ -104,10 +129,6 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() {
// Make sure the app controller has been created.
DCHECK([NSApp delegate]);
- // This is a no-op if the KeystoneRegistration framework is not present.
- // The framework is only distributed with branded Google Chrome builds.
- [[KeystoneGlue defaultKeystoneGlue] registerWithKeystone];
-
// Prevent Cocoa from turning command-line arguments into
// |-application:openFiles:|, since we already handle them directly.
[[NSUserDefaults standardUserDefaults]