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

Side by Side Diff: chrome/browser/mac/relauncher.mm

Issue 2394733002: [Mac Fix-It] removed base::mac::AmIForeground function. (Closed)
Patch Set: Addressed review comment Created 4 years, 2 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 | « base/mac/mac_util.mm ('k') | 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "chrome/browser/mac/relauncher.h" 5 #include "chrome/browser/mac/relauncher.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include <AvailabilityMacros.h> 9 #include <AvailabilityMacros.h>
10 #include <crt_externs.h> 10 #include <crt_externs.h>
11 #include <dlfcn.h> 11 #include <dlfcn.h>
12 #include <stddef.h> 12 #include <stddef.h>
13 #include <string.h> 13 #include <string.h>
14 #include <sys/event.h> 14 #include <sys/event.h>
15 #include <sys/time.h> 15 #include <sys/time.h>
16 #include <sys/types.h> 16 #include <sys/types.h>
17 #include <unistd.h> 17 #include <unistd.h>
18 18
19 #include <string> 19 #include <string>
20 #include <vector> 20 #include <vector>
21 21
22 #include "base/files/file_util.h" 22 #include "base/files/file_util.h"
23 #include "base/files/scoped_file.h" 23 #include "base/files/scoped_file.h"
24 #include "base/logging.h" 24 #include "base/logging.h"
25 #include "base/mac/mac_logging.h" 25 #include "base/mac/mac_logging.h"
26 #include "base/mac/mac_util.h"
27 #include "base/mac/scoped_nsautorelease_pool.h" 26 #include "base/mac/scoped_nsautorelease_pool.h"
28 #include "base/mac/scoped_nsobject.h" 27 #include "base/mac/scoped_nsobject.h"
29 #include "base/path_service.h" 28 #include "base/path_service.h"
30 #include "base/posix/eintr_wrapper.h" 29 #include "base/posix/eintr_wrapper.h"
31 #include "base/process/launch.h" 30 #include "base/process/launch.h"
32 #include "base/strings/stringprintf.h" 31 #include "base/strings/stringprintf.h"
33 #include "base/strings/sys_string_conversions.h" 32 #include "base/strings/sys_string_conversions.h"
34 #include "chrome/browser/mac/install_from_dmg.h" 33 #include "chrome/browser/mac/install_from_dmg.h"
35 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
36 #include "content/public/common/content_paths.h" 35 #include "content/public/common/content_paths.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 93
95 bool RelaunchAppWithHelper(const std::string& helper, 94 bool RelaunchAppWithHelper(const std::string& helper,
96 const std::vector<std::string>& relauncher_args, 95 const std::vector<std::string>& relauncher_args,
97 const std::vector<std::string>& args) { 96 const std::vector<std::string>& args) {
98 std::vector<std::string> relaunch_args; 97 std::vector<std::string> relaunch_args;
99 relaunch_args.push_back(helper); 98 relaunch_args.push_back(helper);
100 relaunch_args.push_back(RelauncherTypeArg()); 99 relaunch_args.push_back(RelauncherTypeArg());
101 100
102 // If this application isn't in the foreground, the relaunched one shouldn't 101 // If this application isn't in the foreground, the relaunched one shouldn't
103 // be either. 102 // be either.
104 if (!base::mac::AmIForeground()) { 103 if (![[NSRunningApplication currentApplication] isActive]) {
105 relaunch_args.push_back(kRelauncherBackgroundArg); 104 relaunch_args.push_back(kRelauncherBackgroundArg);
106 } 105 }
107 106
108 relaunch_args.insert(relaunch_args.end(), 107 relaunch_args.insert(relaunch_args.end(),
109 relauncher_args.begin(), relauncher_args.end()); 108 relauncher_args.begin(), relauncher_args.end());
110 109
111 relaunch_args.push_back(kRelauncherArgSeparator); 110 relaunch_args.push_back(kRelauncherArgSeparator);
112 111
113 // When using the CommandLine interface, -psn_ may have been rewritten as 112 // When using the CommandLine interface, -psn_ may have been rewritten as
114 // --psn_. Look for both. 113 // --psn_. Look for both.
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 if (!dmg_bsd_device_name.empty()) { 367 if (!dmg_bsd_device_name.empty()) {
369 EjectAndTrashDiskImage(dmg_bsd_device_name); 368 EjectAndTrashDiskImage(dmg_bsd_device_name);
370 } 369 }
371 370
372 return 0; 371 return 0;
373 } 372 }
374 373
375 } // namespace internal 374 } // namespace internal
376 375
377 } // namespace mac_relauncher 376 } // namespace mac_relauncher
OLDNEW
« no previous file with comments | « base/mac/mac_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698