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

Unified Diff: base/mac/mac_util.mm

Issue 7497056: Mac Lion: Chrome opens new window on restart when no windows were previously open (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Braces Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac/mac_util.h ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/mac_util.mm
diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm
index 0f341809d0b0a26d57a9e746d77178e975a440dc..60f544fd1ebecec96cd54382a8e5611b19654824 100644
--- a/base/mac/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -56,28 +56,6 @@ void SetUIMode() {
SetSystemUIMode(desired_mode, desired_options);
}
-bool WasLaunchedAsLoginItem() {
- ProcessSerialNumber psn = { 0, kCurrentProcess };
-
- scoped_nsobject<NSDictionary> process_info(
- CFToNSCast(ProcessInformationCopyDictionary(&psn,
- kProcessDictionaryIncludeAllInformationMask)));
-
- long long temp = [[process_info objectForKey:@"ParentPSN"] longLongValue];
- ProcessSerialNumber parent_psn =
- { (temp >> 32) & 0x00000000FFFFFFFFLL, temp & 0x00000000FFFFFFFFLL };
-
- scoped_nsobject<NSDictionary> parent_info(
- CFToNSCast(ProcessInformationCopyDictionary(&parent_psn,
- kProcessDictionaryIncludeAllInformationMask)));
-
- // Check that creator process code is that of loginwindow.
- BOOL result =
- [[parent_info objectForKey:@"FileCreator"] isEqualToString:@"lgnw"];
-
- return result == YES;
-}
-
// Looks into Shared File Lists corresponding to Login Items for the item
// representing the current application. If such an item is found, returns a
// retained reference to it. Caller is responsible for releasing the reference.
@@ -472,13 +450,40 @@ void RemoveFromLoginItems() {
LSSharedFileListItemRemove(login_items, item);
}
+bool WasLaunchedAsLoginOrResumeItem() {
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+
+ scoped_nsobject<NSDictionary> process_info(
+ CFToNSCast(ProcessInformationCopyDictionary(&psn,
+ kProcessDictionaryIncludeAllInformationMask)));
+
+ long long temp = [[process_info objectForKey:@"ParentPSN"] longLongValue];
+ ProcessSerialNumber parent_psn =
+ { (temp >> 32) & 0x00000000FFFFFFFFLL, temp & 0x00000000FFFFFFFFLL };
+
+ scoped_nsobject<NSDictionary> parent_info(
+ CFToNSCast(ProcessInformationCopyDictionary(&parent_psn,
+ kProcessDictionaryIncludeAllInformationMask)));
+
+ // Check that creator process code is that of loginwindow.
+ BOOL result =
+ [[parent_info objectForKey:@"FileCreator"] isEqualToString:@"lgnw"];
+
+ return result == YES;
+}
+
bool WasLaunchedAsHiddenLoginItem() {
- if (!WasLaunchedAsLoginItem())
+ if (!WasLaunchedAsLoginOrResumeItem())
return false;
ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp());
if (!item.get()) {
- LOG(ERROR) << "Process launched at Login but can't access Login Item List.";
+ // Lion can launch items for the resume feature. So log an error only for
+ // Snow Leopard or earlier.
+ if (IsOSSnowLeopardOrEarlier())
+ LOG(ERROR) <<
+ "Process launched at Login but can't access Login Item List.";
+
return false;
}
return IsHiddenLoginItem(item);
« no previous file with comments | « base/mac/mac_util.h ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698