summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 21:47:40 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 21:47:40 +0000
commite3db4fabfc7aabca3cd1998e05d2a769fbd0c5b6 (patch)
tree078bac665188fa8125290b088748ef7957a8b41a /chrome
parent1e312119668de456111dbbf3b3a8de29485f8b73 (diff)
downloadchromium_src-e3db4fabfc7aabca3cd1998e05d2a769fbd0c5b6.zip
chromium_src-e3db4fabfc7aabca3cd1998e05d2a769fbd0c5b6.tar.gz
chromium_src-e3db4fabfc7aabca3cd1998e05d2a769fbd0c5b6.tar.bz2
Implement (kinda) ProcessSingleton for the Mac.
Review URL: http://codereview.chromium.org/88031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14136 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_main.cc5
-rw-r--r--chrome/browser/process_singleton_mac.cc37
-rw-r--r--chrome/chrome.gyp1
-rw-r--r--chrome/common/temp_scaffolding_stubs.h17
4 files changed, 39 insertions, 21 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 83422e6..d687acb 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/plugin_service.h"
+#include "chrome/browser/process_singleton.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/user_data_manager.h"
@@ -96,10 +97,6 @@
#endif // defined(OS_WIN)
-#if !defined(OS_MACOSX)
-#include "chrome/browser/process_singleton.h"
-#endif
-
namespace Platform {
void WillInitializeMainMessageLoop(const CommandLine & command_line);
diff --git a/chrome/browser/process_singleton_mac.cc b/chrome/browser/process_singleton_mac.cc
new file mode 100644
index 0000000..c4884db
--- /dev/null
+++ b/chrome/browser/process_singleton_mac.cc
@@ -0,0 +1,37 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/process_singleton.h"
+
+// This class is used to funnel messages to a single instance of the browser
+// process. This is needed for several reasons on other platforms.
+//
+// On Windows, when the user re-opens the application from the shell (e.g. an
+// explicit double-click, a shortcut that opens a webpage, etc.) we need to send
+// the message to the currently-existing copy of the browser.
+//
+// On Linux, opening a URL is done by creating an instance of the web browser
+// process and passing it the URL to go to on its commandline.
+//
+// Neither of those cases apply on the Mac. Launch Services ensures that there
+// is only one instance of the process, and we get URLs to open via AppleEvents
+// and, once again, the Launch Services system. We have no need to manage this
+// ourselves.
+
+ProcessSingleton::ProcessSingleton(const FilePath& user_data_dir) {
+ // This space intentionally left blank.
+}
+
+ProcessSingleton::~ProcessSingleton() {
+ // This space intentionally left blank.
+}
+
+bool ProcessSingleton::NotifyOtherProcess() {
+ // This space intentionally left blank.
+ return false;
+}
+
+void ProcessSingleton::Create() {
+ // This space intentionally left blank.
+}
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 9092d88..c7b5836 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -938,6 +938,7 @@
'browser/printing/win_printing_context.h',
'browser/process_singleton.h',
'browser/process_singleton_linux.cc',
+ 'browser/process_singleton_mac.cc',
'browser/process_singleton_win.cc',
'browser/profile.cc',
'browser/profile.h',
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 4d5200b..cac23ea 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -48,23 +48,6 @@ class Message;
//---------------------------------------------------------------------------
// These stubs are for Browser_main()
-#if defined(OS_MACOSX)
-// TODO(port): needs an implementation of ProcessSingleton.
-class ProcessSingleton {
- public:
- explicit ProcessSingleton(const FilePath& user_data_dir) { }
- ~ProcessSingleton() { }
- bool NotifyOtherProcess() {
- NOTIMPLEMENTED();
- return false;
- }
- void HuntForZombieChromeProcesses() { NOTIMPLEMENTED(); }
- void Create() { NOTIMPLEMENTED(); }
- void Lock() { NOTIMPLEMENTED(); }
- void Unlock() { NOTIMPLEMENTED(); }
-};
-#endif // defined(OS_MACOSX)
-
class GoogleUpdateSettings {
public:
static bool GetCollectStatsConsent() {