diff options
author | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-13 20:46:29 +0000 |
---|---|---|
committer | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-13 20:46:29 +0000 |
commit | cd6c8304ba29fa49f40db34d072a4e8311100216 (patch) | |
tree | 82af002e7fb0b31ac824873691f7b7c5383643aa /remoting | |
parent | c96484589926db5f95c86efef0f5bdfd35970582 (diff) | |
download | chromium_src-cd6c8304ba29fa49f40db34d072a4e8311100216.zip chromium_src-cd6c8304ba29fa49f40db34d072a4e8311100216.tar.gz chromium_src-cd6c8304ba29fa49f40db34d072a4e8311100216.tar.bz2 |
Port remoting_me2me_host to Mac.
This also changes the default config directory for Windows (removes ".config" from the path).
BUG=117575
TEST=Manual
Review URL: http://codereview.chromium.org/9648018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126458 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/host_event_logger_posix.cc (renamed from remoting/host/host_event_logger_linux.cc) | 49 | ||||
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 20 | ||||
-rw-r--r-- | remoting/host/system_event_logger.h | 27 | ||||
-rw-r--r-- | remoting/host/system_event_logger_linux.cc | 47 | ||||
-rw-r--r-- | remoting/remoting.gyp | 134 |
5 files changed, 108 insertions, 169 deletions
diff --git a/remoting/host/host_event_logger_linux.cc b/remoting/host/host_event_logger_posix.cc index caf1a60..56bc174 100644 --- a/remoting/host/host_event_logger_linux.cc +++ b/remoting/host/host_event_logger_posix.cc @@ -6,21 +6,26 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "base/stringprintf.h" #include "net/base/ip_endpoint.h" #include "remoting/host/chromoting_host.h" #include "remoting/host/host_status_observer.h" -#include "remoting/host/system_event_logger.h" + +// Included here, since the #define for LOG_USER in syslog.h conflicts with the +// constants in base/logging.h, and this source file should use the version in +// syslog.h. +#include <syslog.h> namespace remoting { namespace { -class HostEventLoggerLinux : public HostEventLogger, public HostStatusObserver { +class HostEventLoggerPosix : public HostEventLogger, public HostStatusObserver { public: - HostEventLoggerLinux(ChromotingHost* host, + HostEventLoggerPosix(ChromotingHost* host, const std::string& application_name); - virtual ~HostEventLoggerLinux(); + virtual ~HostEventLoggerPosix(); // HostStatusObserver implementation. These methods will be called from the // network thread. @@ -38,59 +43,61 @@ class HostEventLoggerLinux : public HostEventLogger, public HostStatusObserver { void Log(const std::string& message); scoped_refptr<ChromotingHost> host_; - scoped_ptr<SystemEventLogger> system_event_logger_; + std::string application_name_; - DISALLOW_COPY_AND_ASSIGN(HostEventLoggerLinux); + DISALLOW_COPY_AND_ASSIGN(HostEventLoggerPosix); }; } //namespace -HostEventLoggerLinux::HostEventLoggerLinux(ChromotingHost* host, +HostEventLoggerPosix::HostEventLoggerPosix(ChromotingHost* host, const std::string& application_name) : host_(host), - system_event_logger_(SystemEventLogger::Create(application_name)) { + application_name_(application_name) { + openlog(application_name_.c_str(), 0, LOG_USER); host_->AddStatusObserver(this); } -HostEventLoggerLinux::~HostEventLoggerLinux() { +HostEventLoggerPosix::~HostEventLoggerPosix() { host_->RemoveStatusObserver(this); + closelog(); } -void HostEventLoggerLinux::OnClientAuthenticated(const std::string& jid) { +void HostEventLoggerPosix::OnClientAuthenticated(const std::string& jid) { Log("Client connected: " + jid); } -void HostEventLoggerLinux::OnClientDisconnected(const std::string& jid) { +void HostEventLoggerPosix::OnClientDisconnected(const std::string& jid) { Log("Client disconnected: " + jid); } -void HostEventLoggerLinux::OnAccessDenied(const std::string& jid) { +void HostEventLoggerPosix::OnAccessDenied(const std::string& jid) { Log("Access denied for client: " + jid); } -void HostEventLoggerLinux::OnClientRouteChange( +void HostEventLoggerPosix::OnClientRouteChange( const std::string& jid, const std::string& channel_name, const net::IPEndPoint& remote_end_point, const net::IPEndPoint& local_end_point) { - Log("Channel IP for client: " + jid + - " ip='" + remote_end_point.ToString() + - "' host_ip='" + local_end_point.ToString() + - "' channel='" + channel_name + "'"); + Log(base::StringPrintf( + "Channel IP for client: %s ip='%s' host_ip='%s' channel='%s'", + jid.c_str(), remote_end_point.ToString().c_str(), + local_end_point.ToString().c_str(), channel_name.c_str())); } -void HostEventLoggerLinux::OnShutdown() { +void HostEventLoggerPosix::OnShutdown() { } -void HostEventLoggerLinux::Log(const std::string& message) { - system_event_logger_->Log(message); +void HostEventLoggerPosix::Log(const std::string& message) { + syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str()); } // static scoped_ptr<HostEventLogger> HostEventLogger::Create( ChromotingHost* host, const std::string& application_name) { return scoped_ptr<HostEventLogger>( - new HostEventLoggerLinux(host, application_name)); + new HostEventLoggerPosix(host, application_name)); } } // namespace remoting diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 0440303..693150f 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -55,8 +55,19 @@ const char kApplicationName[] = "remoting_me2me_host"; const char kAuthConfigSwitchName[] = "auth-config"; const char kHostConfigSwitchName[] = "host-config"; +// TODO(lambroslambrou): The default locations should depend on whether Chrome +// branding is enabled - this means also modifying the Python daemon script. +// The actual location of the files is ultimately determined by the service +// daemon and NPAPI implementation - these defaults are only used in case the +// command-line switches are absent. +#if defined(OS_WIN) || defined(OS_MACOSX) const FilePath::CharType kDefaultConfigDir[] = - FILE_PATH_LITERAL(".config/chrome-remote-desktop"); + FILE_PATH_LITERAL("Chrome Remote Desktop"); +#else +const FilePath::CharType kDefaultConfigDir[] = + FILE_PATH_LITERAL("chrome-remote-desktop"); +#endif + const FilePath::CharType kDefaultAuthConfigFile[] = FILE_PATH_LITERAL("auth.json"); const FilePath::CharType kDefaultHostConfigFile[] = @@ -69,9 +80,12 @@ FilePath GetDefaultConfigDir() { FilePath default_config_dir; #if defined(OS_WIN) - PathService::Get(base::DIR_PROFILE, &default_config_dir); + PathService::Get(base::DIR_LOCAL_APP_DATA, &default_config_dir); +#elif defined(OS_MACOSX) + PathService::Get(base::DIR_APP_DATA, &default_config_dir); #else - default_config_dir = file_util::GetHomeDir(); + default_config_dir = file_util::GetHomeDir().Append(FILE_PATH_LITERAL( + ".config")); #endif return default_config_dir.Append(kDefaultConfigDir); diff --git a/remoting/host/system_event_logger.h b/remoting/host/system_event_logger.h deleted file mode 100644 index ee894ee..0000000 --- a/remoting/host/system_event_logger.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2012 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. - -#ifndef REMOTING_HOST_SYSTEM_EVENT_LOGGER_H_ -#define REMOTING_HOST_SYSTEM_EVENT_LOGGER_H_ - -#include <string> - -#include "base/memory/scoped_ptr.h" - -namespace remoting { - -class SystemEventLogger { - public: - virtual ~SystemEventLogger() {} - - virtual void Log(const std::string& message) = 0; - - // Create an event-logger that tags log messages with |application_name|. - static scoped_ptr<SystemEventLogger> Create( - const std::string& application_name); -}; - -} // namespace remoting - -#endif // REMOTING_HOST_SYSTEM_EVENT_LOGGER_H_ diff --git a/remoting/host/system_event_logger_linux.cc b/remoting/host/system_event_logger_linux.cc deleted file mode 100644 index 7100006..0000000 --- a/remoting/host/system_event_logger_linux.cc +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2012 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 "remoting/host/system_event_logger.h" - -#include <syslog.h> - -#include "base/basictypes.h" -#include "base/compiler_specific.h" - -namespace remoting { - -namespace { - -class SystemEventLoggerLinux : public SystemEventLogger { - public: - SystemEventLoggerLinux(const std::string& application_name) - : application_name_(application_name) { - openlog(application_name_.c_str(), 0, LOG_USER); - } - - ~SystemEventLoggerLinux() { - closelog(); - } - - virtual void Log(const std::string& message) OVERRIDE { - syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str()); - } - - private: - // Store this string here, to avoid deleting memory passed to openlog(). - std::string application_name_; - - DISALLOW_COPY_AND_ASSIGN(SystemEventLoggerLinux); -}; - -} // namespace - -// static -scoped_ptr<SystemEventLogger> SystemEventLogger::Create( - const std::string& application_name) { - return scoped_ptr<SystemEventLogger>( - new SystemEventLoggerLinux(application_name)); -} - -} // namespace remoting diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 14da577..adc4934 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -198,82 +198,12 @@ }], # 'linux_dump_symbols==1' ], # end of 'conditions' }, # end of target 'linux_symbols' - - { - 'target_name': 'remoting_me2me_host', - 'type': 'executable', - 'dependencies': [ - 'remoting_base', - 'remoting_host', - 'remoting_jingle_glue', - '../base/base.gyp:base', - '../base/base.gyp:base_i18n', - '../media/media.gyp:media', - ], - 'sources': [ - 'host/host_event_logger_linux.cc', - 'host/host_event_logger.h', - 'host/remoting_me2me_host.cc', - 'host/system_event_logger_linux.cc', - 'host/system_event_logger.h', - ], - }, # end of target 'remoting_me2me_host' - ], # end of 'targets' }], # 'OS=="linux"' ['OS=="win"', { 'targets': [ { - 'target_name': 'remoting_me2me_host', - 'type': 'executable', - 'dependencies': [ - 'remoting_base', - 'remoting_host', - 'remoting_jingle_glue', - '../base/base.gyp:base', - '../base/base.gyp:base_i18n', - '../media/media.gyp:media', - '../ipc/ipc.gyp:ipc', - ], - 'sources': [ - 'host/host_event_logger_win.cc', - 'host/host_event_logger.h', - 'host/remoting_host_messages.mc', - 'host/remoting_me2me_host.cc', - 'host/system_event_logger.h', - ], - 'include_dirs': [ - '<(INTERMEDIATE_DIR)', - ], - # Rule to run the message compiler. - 'rules': [ - { - 'rule_name': 'message_compiler', - 'extension': 'mc', - 'inputs': [ ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/remoting_host_messages.h', - '<(INTERMEDIATE_DIR)/remoting_host_messages.rc', - ], - 'msvs_cygwin_shell': 0, - 'msvs_quote_cmd': 0, - 'action': [ - 'mc.exe -h <(INTERMEDIATE_DIR) -r <(INTERMEDIATE_DIR) <(RULE_INPUT_PATH)', - ], - 'process_outputs_as_sources': 1, - 'message': 'Running message compiler on <(RULE_INPUT_PATH).', - }, - ], - 'msvs_settings': { - 'VCLinkerTool': { - # 2 == /SUBSYSTEM:WINDOWS - 'SubSystem': '2', - }, - }, - }, # end of target 'remoting_me2me_host' - - { 'target_name': 'remoting_service', 'type': 'executable', 'variables': { 'enable_wexit_time_destructors': 1, }, @@ -770,7 +700,7 @@ 'host/simple_host_process.cc', ], 'conditions': [ - [ 'OS=="win"', { + ['OS=="win"', { 'dependencies': [ '../ipc/ipc.gyp:ipc' ], @@ -779,6 +709,68 @@ }, # end of target 'remoting_simple_host' { + 'target_name': 'remoting_me2me_host', + 'type': 'executable', + 'variables': { 'enable_wexit_time_destructors': 1, }, + 'dependencies': [ + 'remoting_base', + 'remoting_host', + 'remoting_jingle_glue', + '../base/base.gyp:base', + '../base/base.gyp:base_i18n', + '../media/media.gyp:media', + ], + 'sources': [ + 'host/host_event_logger.h', + 'host/remoting_me2me_host.cc', + ], + 'conditions': [ + ['os_posix==1', { + 'sources': [ + 'host/host_event_logger_posix.cc', + ], + }], + ['OS=="win"', { + 'dependencies': [ + '../ipc/ipc.gyp:ipc' + ], + 'sources': [ + 'host/host_event_logger_win.cc', + 'host/remoting_host_messages.mc', + ], + 'include_dirs': [ + '<(INTERMEDIATE_DIR)', + ], + # Rule to run the message compiler. + 'rules': [ + { + 'rule_name': 'message_compiler', + 'extension': 'mc', + 'inputs': [ ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/remoting_host_messages.h', + '<(INTERMEDIATE_DIR)/remoting_host_messages.rc', + ], + 'msvs_cygwin_shell': 0, + 'msvs_quote_cmd': 0, + 'action': [ + 'mc.exe -h <(INTERMEDIATE_DIR) -r <(INTERMEDIATE_DIR) <(RULE_INPUT_PATH)', + ], + 'process_outputs_as_sources': 1, + 'message': 'Running message compiler on <(RULE_INPUT_PATH).', + }, + ], + 'msvs_settings': { + 'VCLinkerTool': { + # 2 == /SUBSYSTEM:WINDOWS + 'SubSystem': '2', + }, + }, + }], + ], # end of 'conditions' + }, # end of target 'remoting_me2me_host' + + { 'target_name': 'remoting_host_keygen', 'type': 'executable', 'dependencies': [ |