Commits

Anonymous committed a86848b

Removing ALL old images.

Comments (0)

Files changed (40)

Makefile.in

-#
-# BEGIN SONGBIRD GPL
-# 
-# This file is part of the Songbird web player.
-#
-# Copyright(c) 2005-2008 POTI, Inc.
-# http://www.songbirdnest.com
-# 
-# This file may be licensed under the terms of of the
-# GNU General Public License Version 2 (the "GPL").
-# 
-# Software distributed under the License is distributed 
-# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-# express or implied. See the GPL for the specific language 
-# governing rights and limitations.
-#
-# You should have received a copy of the GPL along with this 
-# program. If not, go to http://www.gnu.org/licenses/gpl.html
-# or write to the Free Software Foundation, Inc., 
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# 
-# END SONGBIRD GPL
-#
-
-DEPTH     = ../..
-topsrcdir = @top_srcdir@
-srcdir    = @srcdir@
-VPATH     = @srcdir@
-  
-include $(DEPTH)/build/autodefs.mk
-
-SUBDIRS = chrome components
-
-# the name of the extension - used to name the XPI file.
-EXTENSION_NAME = mac-remote-control
-# the uuid of the extension - used internally by songbird to identify the
-# extension.
-EXTENSION_UUID = $(EXTENSION_NAME)@songbirdnest.com
-# where is the extension we're building (right here)
-EXTENSION_DIR  = .
-# where do we want to build it into (over there)
-EXTENSION_STAGE_DIR = ./.xpistage
-
-XPI_NAME = $(EXTENSION_NAME)
-
-# Set this to 1 to install the extension
-ifdef DEBUG
-INSTALL_EXTENSION = 1
-endif
-
-include $(topsrcdir)/build/rules.mk

chrome/.DS_Store

Binary file removed.

chrome/.svn/all-wcprops

-K 25
-svn:wc:ra_dav:version-url
-V 71
-/songbird/client/!svn/ver/7658/trunk/extensions/xpcom_helloworld/chrome
-END
-Makefile.in
-K 25
-svn:wc:ra_dav:version-url
-V 83
-/songbird/client/!svn/ver/7658/trunk/extensions/xpcom_helloworld/chrome/Makefile.in
-END
-jar.mn.in
-K 25
-svn:wc:ra_dav:version-url
-V 81
-/songbird/client/!svn/ver/6743/trunk/extensions/xpcom_helloworld/chrome/jar.mn.in
-END

chrome/.svn/entries

-8
-
-dir
-9791
-https://nick@svn.songbirdnest.com/songbird/client/trunk/extensions/xpcom_helloworld/chrome
-https://nick@svn.songbirdnest.com/songbird/client
-
-
-
-2007-12-20T02:13:55.722209Z
-7658
-lone
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-d2e72017-4f0e-0410-a358-c7ac897c0fe5
-
-locales
-dir
-
-Makefile.in
-file
-
-
-
-
-2008-06-26T18:15:39.000000Z
-7f1c9314d390d1195ba02833d13f22bf
-2007-12-20T02:13:55.722209Z
-7658
-lone
-
-skin
-dir
-
-content
-dir
-
-jar.mn.in
-file
-
-
-
-
-2008-06-26T18:15:39.000000Z
-6be1dd934262ecb9cf44aaa38bcc14a7
-2007-10-15T17:28:55.919311Z
-6743
-matt
-

chrome/.svn/format

-8

chrome/.svn/text-base/Makefile.in.svn-base

-#
-# BEGIN SONGBIRD GPL
-# 
-# This file is part of the Songbird web player.
-#
-# Copyright(c) 2005-2008 POTI, Inc.
-# http://www.songbirdnest.com
-# 
-# This file may be licensed under the terms of of the
-# GNU General Public License Version 2 (the "GPL").
-# 
-# Software distributed under the License is distributed 
-# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-# express or implied. See the GPL for the specific language 
-# governing rights and limitations.
-#
-# You should have received a copy of the GPL along with this 
-# program. If not, go to http://www.gnu.org/licenses/gpl.html
-# or write to the Free Software Foundation, Inc., 
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# 
-# END SONGBIRD GPL
-#
-
-DEPTH     = ../../..
-topsrcdir = @top_srcdir@
-srcdir    = @srcdir@
-VPATH     = @srcdir@
-  
-include $(DEPTH)/build/autodefs.mk
-
-# where we are putting the extension while we're building it
-EXTENSION_STAGE_DIR = $(SONGBIRD_OBJDIR)/extensions/xpcom_helloworld/.xpistage
-
-# make a jar based on the jar.mn (jar.mn.in, actually)
-JAR_MANIFEST = jar.mn
-# and put it into our extension stage directory
-JAR_TARGET_DIR = $(EXTENSION_STAGE_DIR)/chrome
-
-include $(topsrcdir)/build/rules.mk

chrome/.svn/text-base/jar.mn.in.svn-base

-# a little about jar.mn.in...
-# lines starting with "#" (like this one) are comments
-
-# this says we're creating a new jar file
-xpcom_helloworld.jar:
-# map the things under content/ to chrome://xpcom_helloworld/content/
-% content  xpcom_helloworld  %content/
-# map in the locale
-% locale  xpcom_helloworld en-US %locales/en-US/
-# map in the skin
-% skin xpcom_helloworld classic/1.0 %skin/
-# apply an overlay to all Songbird main windows
-% overlay windowtype:Songbird:Main chrome://xpcom_helloworld/content/overlay.xul
-# include all the files in this jar
-@include_all_to 

chrome/Makefile.in

-#
-# BEGIN SONGBIRD GPL
-# 
-# This file is part of the Songbird web player.
-#
-# Copyright(c) 2005-2008 POTI, Inc.
-# http://www.songbirdnest.com
-# 
-# This file may be licensed under the terms of of the
-# GNU General Public License Version 2 (the "GPL").
-# 
-# Software distributed under the License is distributed 
-# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-# express or implied. See the GPL for the specific language 
-# governing rights and limitations.
-#
-# You should have received a copy of the GPL along with this 
-# program. If not, go to http://www.gnu.org/licenses/gpl.html
-# or write to the Free Software Foundation, Inc., 
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# 
-# END SONGBIRD GPL
-#
-
-DEPTH     = ../../..
-topsrcdir = @top_srcdir@
-srcdir    = @srcdir@
-VPATH     = @srcdir@
-  
-include $(DEPTH)/build/autodefs.mk
-
-# where we are putting the extension while we're building it
-EXTENSION_STAGE_DIR = $(SONGBIRD_OBJDIR)/extensions/mac-remote-control/.xpistage
-
-# make a jar based on the jar.mn (jar.mn.in, actually)
-JAR_MANIFEST = jar.mn
-# and put it into our extension stage directory
-JAR_TARGET_DIR = $(EXTENSION_STAGE_DIR)/chrome
-
-include $(topsrcdir)/build/rules.mk

chrome/content/.svn/all-wcprops

-K 25
-svn:wc:ra_dav:version-url
-V 79
-/songbird/client/!svn/ver/7658/trunk/extensions/xpcom_helloworld/chrome/content
-END
-overlay.xul
-K 25
-svn:wc:ra_dav:version-url
-V 91
-/songbird/client/!svn/ver/7658/trunk/extensions/xpcom_helloworld/chrome/content/overlay.xul
-END
-overlay.js
-K 25
-svn:wc:ra_dav:version-url
-V 90
-/songbird/client/!svn/ver/7658/trunk/extensions/xpcom_helloworld/chrome/content/overlay.js
-END

chrome/content/.svn/entries

-8
-
-dir
-9791
-https://nick@svn.songbirdnest.com/songbird/client/trunk/extensions/xpcom_helloworld/chrome/content
-https://nick@svn.songbirdnest.com/songbird/client
-
-
-
-2007-12-20T02:13:55.722209Z
-7658
-lone
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-d2e72017-4f0e-0410-a358-c7ac897c0fe5
-
-overlay.xul
-file
-
-
-
-
-2008-06-26T18:15:39.000000Z
-a84573049a348a902e788cb524a88764
-2007-12-20T02:13:55.722209Z
-7658
-lone
-
-overlay.js
-file
-
-
-
-
-2008-06-26T18:15:39.000000Z
-a6203690a6e35dcf5e9cf8a17ae30efb
-2007-12-20T02:13:55.722209Z
-7658
-lone
-

chrome/content/.svn/format

-8

chrome/content/.svn/text-base/overlay.js.svn-base

-/*
-//
-// BEGIN SONGBIRD GPL
-// 
-// This file is part of the Songbird web player.
-//
-// Copyright(c) 2005-2008 POTI, Inc.
-// http://songbirdnest.com
-// 
-// This file may be licensed under the terms of of the
-// GNU General Public License Version 2 (the "GPL").
-// 
-// Software distributed under the License is distributed 
-// on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-// express or implied. See the GPL for the specific language 
-// governing rights and limitations.
-//
-// You should have received a copy of the GPL along with this 
-// program. If not, go to http://www.gnu.org/licenses/gpl.html
-// or write to the Free Software Foundation, Inc., 
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// 
-// END SONGBIRD GPL
-//
- */
- 
- 
-function testXPCOMHelloWorld() {
-  try {
-    var helloWorld = Components.classes["@songbirdnest.com/Songbird/HelloWorld;1"]
-                               .createInstance(Components.interfaces.sbIHelloWorld);
-    alert("sbIHelloWorld.getMessage(): " + helloWorld.getMessage());
-  } catch (e) {
-    alert("sbIHelloWorld.getMessage() ERROR: " + e.toString());
-  }
-};

chrome/content/.svn/text-base/overlay.xul.svn-base

-<?xml version="1.0"?>
-<!--
-/*
-//
-// BEGIN SONGBIRD GPL
-// 
-// This file is part of the Songbird web player.
-//
-// Copyright(c) 2005-2008 POTI, Inc.
-// http://songbirdnest.com
-// 
-// This file may be licensed under the terms of of the
-// GNU General Public License Version 2 (the "GPL").
-// 
-// Software distributed under the License is distributed 
-// on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-// express or implied. See the GPL for the specific language 
-// governing rights and limitations.
-//
-// You should have received a copy of the GPL along with this 
-// program. If not, go to http://www.gnu.org/licenses/gpl.html
-// or write to the Free Software Foundation, Inc., 
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// 
-// END SONGBIRD GPL
-//
- */
--->
-
-
-<overlay id="xpcom_helloworld_overlay"
-         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-         
-      <script type="application/x-javascript" 
-       src="chrome://xpcom_helloworld/content/overlay.js"/>
-   
-      <menupopup id="menu_ToolsPopup">
-        <menuitem id="xpcom_helloworld_menuitem" 
-                  label="Test XPCOM Hello World"
-                  oncommand="testXPCOMHelloWorld();" />
-      </menupopup>
-   
-</overlay>

chrome/content/overlay.js

-/*
-//
-// BEGIN SONGBIRD GPL
-// 
-// This file is part of the Songbird web player.
-//
-// Copyright(c) 2005-2008 POTI, Inc.
-// http://songbirdnest.com
-// 
-// This file may be licensed under the terms of of the
-// GNU General Public License Version 2 (the "GPL").
-// 
-// Software distributed under the License is distributed 
-// on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-// express or implied. See the GPL for the specific language 
-// governing rights and limitations.
-//
-// You should have received a copy of the GPL along with this 
-// program. If not, go to http://www.gnu.org/licenses/gpl.html
-// or write to the Free Software Foundation, Inc., 
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// 
-// END SONGBIRD GPL
-//
- */
-
-var Cc = Components.classes;
-var Ci = Components.interfaces;
-
-
-var isListening = false;
-var gRemoteControlService = Cc["@songbirdnest.com/mac-remote-service;1"]
-                            .getService(Ci.sbIAppleRemoteService);
-
-
-//
-// @brief If the current machine doesn't support the apple remote, don't
-//        enable the menu item.
-//
-if (!gRemoteControlService.isSupported) {
-  // HACK: Set a timeout to find the menuitem..
-  setTimeout(
-    function() { 
-      var menuItem = document.getElementById("mac_remote_menuitem");
-      if (menuItem) {
-        menuItem.setAttribute("disabled", "true");
-      }
-    }, 1000);
-}
-
-
-//
-// @brief Callback function from menuitem.
-// 
-function ToggleAppleRemote()
-{
-  if (isListening) {
-    gRemoteControlService.stopListening();
-    isListening = false;
-  }
-  else {
-    gRemoteControlService.startListening();
-    isListening = true;
-  }
-}

chrome/content/overlay.xul

-<?xml version="1.0"?>
-<!--
-/*
-//
-// BEGIN SONGBIRD GPL
-// 
-// This file is part of the Songbird web player.
-//
-// Copyright(c) 2005-2008 POTI, Inc.
-// http://songbirdnest.com
-// 
-// This file may be licensed under the terms of of the
-// GNU General Public License Version 2 (the "GPL").
-// 
-// Software distributed under the License is distributed 
-// on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-// express or implied. See the GPL for the specific language 
-// governing rights and limitations.
-//
-// You should have received a copy of the GPL along with this 
-// program. If not, go to http://www.gnu.org/licenses/gpl.html
-// or write to the Free Software Foundation, Inc., 
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// 
-// END SONGBIRD GPL
-//
- */
--->
-
-<overlay id="mac-remote-control-overlay"
-         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-         
-    <script type="application/x-javascript" 
-       src="chrome://mac-remote-control/content/overlay.js"/>
- 
-    <menupopup id="menu_ControlsPopup">
-      <menuseparator/>
-      <menuitem id="mac_remote_menuitem" 
-                type="checkbox"
-                label="Enable Apple Remote"
-                oncommand="ToggleAppleRemote();" />
-    </menupopup>
-   
-</overlay>

chrome/jar.mn.in

-# a little about jar.mn.in...
-# lines starting with "#" (like this one) are comments
-
-# this says we're creating a new jar file
-mac-remote-control.jar:
-# map the things under content/ to chrome://xpcom_helloworld/content/
-% content  mac-remote-control  %content/
-# map in the locale
-% locale  mac-remote-control en-US %locales/en-US/
-# map in the skin
-% skin mac-remote-control classic/1.0 %skin/
-# apply an overlay to all Songbird main windows
-% overlay windowtype:Songbird:Main chrome://mac-remote-control/content/overlay.xul
-# include all the files in this jar
-@include_all_to 

chrome/locales/.svn/all-wcprops

-K 25
-svn:wc:ra_dav:version-url
-V 79
-/songbird/client/!svn/ver/6457/trunk/extensions/xpcom_helloworld/chrome/locales
-END

chrome/locales/.svn/entries

-8
-
-dir
-9791
-https://nick@svn.songbirdnest.com/songbird/client/trunk/extensions/xpcom_helloworld/chrome/locales
-https://nick@svn.songbirdnest.com/songbird/client
-
-
-
-2007-09-12T23:21:32.516496Z
-6328
-matt
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-d2e72017-4f0e-0410-a358-c7ac897c0fe5
-

chrome/locales/.svn/format

-8

chrome/skin/.svn/all-wcprops

-K 25
-svn:wc:ra_dav:version-url
-V 76
-/songbird/client/!svn/ver/6457/trunk/extensions/xpcom_helloworld/chrome/skin
-END

chrome/skin/.svn/entries

-8
-
-dir
-9791
-https://nick@svn.songbirdnest.com/songbird/client/trunk/extensions/xpcom_helloworld/chrome/skin
-https://nick@svn.songbirdnest.com/songbird/client
-
-
-
-2007-09-12T23:21:32.516496Z
-6328
-matt
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-d2e72017-4f0e-0410-a358-c7ac897c0fe5
-

chrome/skin/.svn/format

-8

components/.DS_Store

Binary file removed.

components/.svn/all-wcprops

-K 25
-svn:wc:ra_dav:version-url
-V 75
-/songbird/client/!svn/ver/8448/trunk/extensions/xpcom_helloworld/components
-END
-Makefile.in
-K 25
-svn:wc:ra_dav:version-url
-V 87
-/songbird/client/!svn/ver/7658/trunk/extensions/xpcom_helloworld/components/Makefile.in
-END

components/.svn/entries

-8
-
-dir
-9791
-https://nick@svn.songbirdnest.com/songbird/client/trunk/extensions/xpcom_helloworld/components
-https://nick@svn.songbirdnest.com/songbird/client
-
-
-
-2008-03-04T02:48:29.455052Z
-8448
-mook
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-d2e72017-4f0e-0410-a358-c7ac897c0fe5
-
-Makefile.in
-file
-
-
-
-
-2008-06-26T18:15:39.000000Z
-acbccb7781c9a341077eb1a3d07bc409
-2007-12-20T02:13:55.722209Z
-7658
-lone
-
-helloworld
-dir
-

components/.svn/format

-8

components/.svn/text-base/Makefile.in.svn-base

-#
-# BEGIN SONGBIRD GPL
-# 
-# This file is part of the Songbird web player.
-#
-# Copyright(c) 2005-2008 POTI, Inc.
-# http://www.songbirdnest.com
-# 
-# This file may be licensed under the terms of of the
-# GNU General Public License Version 2 (the "GPL").
-# 
-# Software distributed under the License is distributed 
-# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-# express or implied. See the GPL for the specific language 
-# governing rights and limitations.
-#
-# You should have received a copy of the GPL along with this 
-# program. If not, go to http://www.gnu.org/licenses/gpl.html
-# or write to the Free Software Foundation, Inc., 
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# 
-# END SONGBIRD GPL
-#
-
-DEPTH = ../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/build/autodefs.mk
-
-SUBDIRS = helloworld \
-          $(NULL)
-
-include $(topsrcdir)/build/rules.mk

components/Makefile.in

-#
-# BEGIN SONGBIRD GPL
-# 
-# This file is part of the Songbird web player.
-#
-# Copyright(c) 2005-2008 POTI, Inc.
-# http://www.songbirdnest.com
-# 
-# This file may be licensed under the terms of of the
-# GNU General Public License Version 2 (the "GPL").
-# 
-# Software distributed under the License is distributed 
-# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-# express or implied. See the GPL for the specific language 
-# governing rights and limitations.
-#
-# You should have received a copy of the GPL along with this 
-# program. If not, go to http://www.gnu.org/licenses/gpl.html
-# or write to the Free Software Foundation, Inc., 
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# 
-# END SONGBIRD GPL
-#
-
-DEPTH = ../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/build/autodefs.mk
-
-SUBDIRS = macremote \
-          $(NULL)
-
-include $(topsrcdir)/build/rules.mk

components/macremote/.DS_Store

Binary file modified.

components/macremote/Makefile.in

-#
-# BEGIN SONGBIRD GPL
-#
-# This file is part of the Songbird web player.
-#
-# Copyright(c) 2005-2008 POTI, Inc.
-# http://songbirdnest.com
-#
-# This file may be licensed under the terms of of the
-# GNU General Public License Version 2 (the "GPL").
-#
-# Software distributed under the License is distributed
-# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
-# express or implied. See the GPL for the specific language
-# governing rights and limitations.
-#
-# You should have received a copy of the GPL along with this
-# program. If not, go to http://www.gnu.org/licenses/gpl.html
-# or write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# END SONGBIRD GPL
-#
-
-DEPTH = ../../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/build/autodefs.mk
-
-SUBDIRS = public \
-          src \
-          $(NULL)
-
-SUBDIRDEPS  = src : public
-
-include $(topsrcdir)/build/rules.mk
-

components/macremote/public/Makefile.in

-#
-# BEGIN SONGBIRD GPL
-#
-# This file is part of the Songbird web player.
-#
-# Copyright(c) 2005-2008 POTI, Inc.
-# http://songbirdnest.com
-#
-# This file may be licensed under the terms of of the
-# GNU General Public License Version 2 (the "GPL").
-#
-# Software distributed under the License is distributed
-# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
-# express or implied. See the GPL for the specific language
-# governing rights and limitations.
-#
-# You should have received a copy of the GPL along with this
-# program. If not, go to http://www.gnu.org/licenses/gpl.html
-# or write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# END SONGBIRD GPL
-#
-
-DEPTH = ../../../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/build/autodefs.mk
-
-# compile these IDL files
-XPIDL_SRCS = sbIMacRemoteControl.idl \
-             $(NULL)
-
-# into this xpt (an xpt is like a compiled IDL read at runtime)
-XPIDL_MODULE = sbMacRemoteController.xpt
-XPIDL_MODULE_TYPELIBS = $(XPIDL_SRCS:.idl=.xpt)
-
-# and put it into the extension
-EXTENSION_STAGE_DIR = $(SONGBIRD_OBJDIR)/extensions/mac-remote-control/.xpistage
-
-# distribute the xpt into the components directory
-SONGBIRD_COMPONENTS = $(XPIDL_MODULE)
-
-include $(topsrcdir)/build/rules.mk
-

components/macremote/public/sbIMacRemoteControl.idl

-/*
-//
-// BEGIN SONGBIRD GPL
-// 
-// This file is part of the Songbird web player.
-//
-// Copyright(c) 2005-2008 POTI, Inc.
-// http://songbirdnest.com
-// 
-// This file may be licensed under the terms of of the
-// GNU General Public License Version 2 (the "GPL").
-// 
-// Software distributed under the License is distributed 
-// on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
-// express or implied. See the GPL for the specific language 
-// governing rights and limitations.
-//
-// You should have received a copy of the GPL along with this 
-// program. If not, go to http://www.gnu.org/licenses/gpl.html
-// or write to the Free Software Foundation, Inc., 
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-// 
-// END SONGBIRD GPL
-//
- */
- 
-#include "nsISupports.idl"
-
-
-//
-// Service provider for listening to Apple Remote events.
-//
-[scriptable, uuid(9F2B0AFE-164B-49D7-8873-8AD867A97F0E)]
-interface sbIAppleRemoteService : nsISupports
-{
-  void startListening();
-  void stopListening();
-  readonly attribute boolean isSupported;
-};

components/macremote/src/.DS_Store

Binary file removed.

components/macremote/src/Makefile.in

-#
-# BEGIN SONGBIRD GPL
-#
-# This file is part of the Songbird web player.
-#
-# Copyright(c) 2005-2008 POTI, Inc.
-# http://songbirdnest.com
-#
-# This file may be licensed under the terms of of the
-# GNU General Public License Version 2 (the "GPL").
-#
-# Software distributed under the License is distributed
-# on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
-# express or implied. See the GPL for the specific language
-# governing rights and limitations.
-#
-# You should have received a copy of the GPL along with this
-# program. If not, go to http://www.gnu.org/licenses/gpl.html
-# or write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# END SONGBIRD GPL
-#
-
-DEPTH = ../../../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/build/autodefs.mk
-
-# the name of our component
-target_name = sbMacRemoteController
-
-CMM_SRCS = SBAppleRemoteListener.mm                 \
-           sbAppleRemoteService.mm          \
-           sbAppleRemoteModule.mm           \
-           $(NULL)
-
-CMM_INCLUDES = $(DEPTH)/extensions/mac-remote-control/components/macremote/public \
-               $(DEPTH)/components/library/base/public \
-               $(DEPTH)/components/mediacore/base/public \
-               $(MOZSDK_INCLUDE_DIR) \
-               $(MOZSDK_INCLUDE_DIR)/nspr \
-               $(MOZSDK_INCLUDE_DIR)/necko \
-               $(MOZSDK_INCLUDE_DIR)/xpcom \
-               $(MOZSDK_INCLUDE_DIR)/string \
-               $(MOZSDK_IDL_DIR) \
-               $(NULL)
-
-IS_COMPONENT = 1
-
-DYNAMIC_LIB = $(target_name)$(DLL_SUFFIX)
-
-DYNAMIC_LIB_OBJS = $(patsubst %.mm,%$(OBJ_SUFFIX),$(notdir $(CMM_SRCS)))
-
-DYNAMIC_LIB_EXTRA_IMPORTS = nspr4 \
-                            xpcom \
-                            xpcomglue_s \
-                            $(NULL)
-
-DYNAMIC_LIB_IMPORT_PATHS = $(MOZSDK_LIB_DIR) \
-                           $(NULL)
-
-DYNAMIC_LIB_EXTRA_FLAGS= -framework Foundation -framework System -framework Carbon -framework IOKit -framework Cocoa -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
-
-DYNAMIC_LIB_EXTRA_IMPORTS += mozjs
-
-# put this in our staging directory
-EXTENSION_STAGE_DIR = $(SONGBIRD_OBJDIR)/extensions/mac-remote-control/.xpistage
-
-# into components/ 
-SONGBIRD_COMPONENTS = $(DYNAMIC_LIB)
-
-include $(topsrcdir)/build/rules.mk
-

components/macremote/src/SBAppleRemoteListener.h

-/*
- // BEGIN SONGBIRD GPL
- //
- //
- // This file is part of the Songbird web player.
- //
- // Copyright(c) 2005-2008 POTI, Inc.
- // http://songbirdnest.com
- //
- // This file may be licensed under the terms of of the
- // GNU General Public License Version 2 (the "GPL").
- //
- // Software distributed under the License is distributed
- // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
- // express or implied. See the GPL for the specific language
- // governing rights and limitations.
- //
- // You should have received a copy of the GPL along with this
- // program. If not, go to http://www.gnu.org/licenses/gpl.html
- // or write to the Free Software Foundation, Inc.,
- // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- //
- // END SONGBIRD GPL
- //
- */
-
-#import <Cocoa/Cocoa.h>
-#import <IOKit/hid/IOHIDLib.h>
-
-//
-// @brief Apple remote control buttons
-//
-typedef enum {
-  eUnknownButton  = -1,
-  ePlusButton     = 0,
-  eMinusButton    = 1,
-  eMenuButton     = 2,
-  ePlayButton     = 3,
-  eRightButton    = 4,
-  eLeftButton     = 5,
-} EAppleRemoteButton;
-
-
-//
-// @brief Informal protocol for getting callback information about Apple
-//        remote control events.
-//
-@interface NSObject (AppleRemoteDelegate)
-
-//
-// @brief Callback function when a button is pressed.
-//
-- (void)onButtonPressed:(EAppleRemoteButton)aButton isHold:(BOOL)aIsHold;
-
-//
-// @brief Callback function when a button is released.
-//
-- (void)onButtonReleased:(EAppleRemoteButton)aButton;
-
-@end
-
-
-//
-// @brief A class for listening to Apple Remote Control Events.
-//     
-// XXXkreeger --> Better name here please...
-//
-@interface SBAppleRemoteListener : NSObject
-{
-  IOHIDDeviceInterface   **mDeviceInterface;
-  IOHIDQueueInterface    **mQueueInterface;
-  CFRunLoopSourceRef	   mEventSource;
-  NSArray                *mCookies;               // strong
-  id                     mDelegate;               // weak
-  BOOL                   mIsListening;
-  EAppleRemoteButton     mPendingHoldButton;
-}
-
-//
-// @brief Find out if the current machine supports the Apple remote.
-//
-+ (BOOL)isRemoteAvailable;
-
-//
-// @brief Create a remote control listener for the Apple remote with a 
-//        callback delegate. This function will not start listening for
-//        device events. To engage listening, call |startListening|.
-//
-- (id)initWithDelegate:(id)aDelegate;
-
-//
-// @brief Start listening to the apple remote. This will claim exclusive 
-//        access to the device. To release exclusive access, call 
-//        |stopListening|.
-//
-- (void)startListening;
-
-//
-// @brief Stop listening to the device. This method will release exclusive
-//        access to the device.
-//
-- (void)stopListening;
-
-//
-// @brief Get the listening state of the remote.
-//
-- (BOOL)IsListening;
-
-//
-// @brief Set the remote delegate.
-//
-- (void)setDelegate:(id)aDelegate;
-
-@end

components/macremote/src/SBAppleRemoteListener.mm

-/*
- // BEGIN SONGBIRD GPL
- //
- //
- // This file is part of the Songbird web player.
- //
- // Copyright(c) 2005-2008 POTI, Inc.
- // http://songbirdnest.com
- //
- // This file may be licensed under the terms of of the
- // GNU General Public License Version 2 (the "GPL").
- //
- // Software distributed under the License is distributed
- // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
- // express or implied. See the GPL for the specific language
- // governing rights and limitations.
- //
- // You should have received a copy of the GPL along with this
- // program. If not, go to http://www.gnu.org/licenses/gpl.html
- // or write to the Free Software Foundation, Inc.,
- // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- //
- // END SONGBIRD GPL
- //
- */
-
-#import "SBAppleRemoteListener.h"
-#import <IOKit/IOKitLib.h>
-#import <IOKit/IOCFPlugIn.h>
-#import <IOKit/hid/IOHIDKeys.h>
-#import <AppKit/AppKit.h>
-#import <mach/mach.h>
-#import <mach/mach_error.h>
-
-// Enable IO logging:
-#define LOG_IO_ERRORS   0
-
-// AppKit Version for 10.4
-#define NSAppKitVersionNumber10_4 824
-
-// Don't expose the hold-button events via the enum
-#define RIGHT_BUTTON_HOLD   6
-#define LEFT_BUTTON_HOLD    7
-#define MENU_BUTTON_HOLD    8
-#define PLAY_BUTTON_HOLD    9
-
-// Globals:
-static const char   *sAppleRemoteDeviceName = "AppleIRController";
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-@interface SBAppleRemoteListener (Private)
-
-- (void)_onQueueCallback:(IOReturn)aResult;
-+ (io_object_t)_findDevice;
-- (IOHIDDeviceInterface **)_createInterface:(io_object_t)aDevice;
-- (IOCFPlugInInterface **)_getPluginInterface:(io_object_t)aDevice;
-- (NSArray *)_readDeviceCookies:(IOHIDDeviceInterface **)aDeviceInterface;
-- (EAppleRemoteButton)_buttonForCookie:(NSString *)aCookieStr 
-                           isHoldEvent:(BOOL *)aIsHoldEvent;
-- (NSDictionary *)_getCookieButtonsDict;
-- (void)_handleEventWithCookieString:(NSString *)aCookieStr 
-                         sumOfValues:(SInt32)aSumOfValues;
-
-@end
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-static void QueueCallbackFunction(void *target,  
-                                  IOReturn result, 
-                                  void *refcon, 
-                                  void *sender) 
-{
-  if (target < 0) {
-    return; 
-  }
-  
-  NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-  
-  SBAppleRemoteListener *appleRemote = (SBAppleRemoteListener *)target;
-  if (appleRemote) {
-    [appleRemote _onQueueCallback:result];
-  }
-  
-  [pool release];
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-@implementation SBAppleRemoteListener
-
-+ (BOOL)isRemoteAvailable
-{
-  BOOL exists = NO;
-  io_object_t device = [SBAppleRemoteListener _findDevice];
-  if (device != 0) {
-    IOObjectRelease(device);
-    exists = YES;
-  }
-  
-  return exists;
-}
-
-
-- (id)init
-{
-  if ((self = [super init])) {
-    mPendingHoldButton = eUnknownButton;
-  }
-  
-  return self;
-}
-
-
-- (id)initWithDelegate:(id)aDelegate
-{
-  if ((self = [self init])) {
-    mDelegate = aDelegate;
-  }
-  
-  return self;
-}
-
-
-- (void)dealloc
-{
-  if (mIsListening)
-    [self stopListening];
-  
-  [super dealloc];
-}
-
-
-- (void)startListening
-{
-  io_object_t hidDevice = [SBAppleRemoteListener _findDevice];
-  if (hidDevice == 0) {
-#if LOG_IO_ERRORS
-    NSLog(@"ERROR: Could not find the device in I/O registry!!!");
-#endif
-    return;
-  }
-  
-  //
-  // 1.) Create interface for device
-  // 2.) Init cookies
-  // 3.) Open device
-  //
-  
-  //
-  // 1.) Create an interface for the device:
-  //
-  mDeviceInterface = [self _createInterface:hidDevice];
-  if (mDeviceInterface == NULL) {
-#if LOG_IO_ERRORS
-    NSLog(@"ERROR: Could not create an interface for the device!");
-#endif
-    return;
-  }
-  
-  //
-  // 2.) Init device cookies:
-  //
-  mCookies = [self _readDeviceCookies:mDeviceInterface];
-  
-  //
-  // 3.) Open the device
-  //
-  // XXXkreeger: If this doesn't steal the events from FrontRow, I'll need to
-  //             change this flag to: |kIOHIDOptionsTypeSeizeDevice|.
-  IOHIDOptionsType openMode = kIOHIDOptionsTypeSeizeDevice;  
-  IOReturn ioResult= (*mDeviceInterface)->open(mDeviceInterface, openMode);
-  if (ioResult == KERN_SUCCESS) {
-    mQueueInterface = (*mDeviceInterface)->allocQueue(mDeviceInterface);
-    if (mQueueInterface) {
-      // depth: maximum number of elements in queue before oldest elements 
-      //        in queue begin to be lost.
-      (*mQueueInterface)->create(mQueueInterface, 0, 12);
-      
-      // Add the found cookies to the queue.
-      NSNumber *curCookie = nil;
-      NSEnumerator *cookiesEnum = [mCookies objectEnumerator];
-      while ((curCookie = [cookiesEnum nextObject])) {
-        (*mQueueInterface)->addElement(mQueueInterface, 
-                                       (IOHIDElementCookie)[curCookie intValue], 
-                                       0);
-      }
-      
-      // Add callbacks for async events:
-      ioResult = (*mQueueInterface)->createAsyncEventSource(mQueueInterface, 
-                                                            &mEventSource);
-      if (ioResult == KERN_SUCCESS) {
-        ioResult = (*mQueueInterface)->setEventCallout(mQueueInterface,
-                                                       QueueCallbackFunction,
-                                                       self, 
-                                                       NULL); 
-        if (ioResult == KERN_SUCCESS) {
-          CFRunLoopAddSource(CFRunLoopGetCurrent(), 
-                             mEventSource, 
-                             kCFRunLoopDefaultMode); 
-          // Begin queue delivery
-          (*mQueueInterface)->start(mQueueInterface);
-        }
-      }
-    }
-  }
-  else if (ioResult == kIOReturnExclusiveAccess) {
-    // XXXkreeger -> Handle waiting until exclusive access is over.
-  }
-  
-  IOObjectRelease(hidDevice);
-  mIsListening = YES;
-}
-
-
-- (void)stopListening
-{
-  if (mEventSource) {
-    CFRunLoopRemoveSource(CFRunLoopGetCurrent(), 
-                          mEventSource, 
-                          kCFRunLoopDefaultMode);
-    CFRelease(mEventSource);
-    mEventSource = NULL;
-  }
-  
-  if (mQueueInterface) {
-    (*mQueueInterface)->stop(mQueueInterface);
-    (*mQueueInterface)->dispose(mQueueInterface);
-    (*mQueueInterface)->Release(mQueueInterface);
-    mQueueInterface = NULL;
-  }
-  
-  if (mDeviceInterface) {
-    (*mDeviceInterface)->close(mDeviceInterface);
-    (*mDeviceInterface)->Release(mDeviceInterface);
-    mDeviceInterface = NULL;
-  }
-  
-  if (mCookies) {
-    [mCookies release];
-  }
-  
-  mIsListening = NO;
-}
-
-
-- (BOOL)IsListening
-{
-  return mIsListening;
-}
-
-
-- (void)setDelegate:(id)aDelegate
-{
-  mDelegate = aDelegate;
-}
-
-
-- (void)_onQueueCallback:(IOReturn)aResult
-{
-  AbsoluteTime zeroTime = { 0, 0 };
-  SInt32 sumOfValues = 0;
-  NSMutableString *cookieString = [[NSMutableString alloc] init];
-  
-  while (aResult == kIOReturnSuccess) {
-    IOHIDEventStruct curEvent;
-    
-    aResult = (*mQueueInterface)->getNextEvent(mQueueInterface, 
-                                              &curEvent, 
-                                              zeroTime, 
-                                              0);
-    if (aResult != kIOReturnSuccess)
-      break;
-    
-    // XXXkreeger: Handle remote switch event?
-    
-    sumOfValues += curEvent.value;
-    [cookieString appendString:
-      [NSString stringWithFormat:@"%d_", (int)curEvent.elementCookie]];
-  }
-  
-  [self _handleEventWithCookieString:cookieString sumOfValues:sumOfValues];
-}
-
-
-- (void)_handleEventWithCookieString:(NSString *)aCookieStr 
-                         sumOfValues:(SInt32)aSumOfValues
-{
-  if (!aCookieStr)
-    return;
-  
-  BOOL isHoldEvent = NO;
-  EAppleRemoteButton button = [self _buttonForCookie:aCookieStr 
-                                         isHoldEvent:&isHoldEvent];
-  
-  if (mDelegate && button != eUnknownButton) {
-    if (isHoldEvent) {
-      // Save this flag for informing the delegate about 'release' events.
-      if (mPendingHoldButton == eUnknownButton) {
-        // The hold event is starting, stash this event
-        mPendingHoldButton = button;
-      }
-      else {
-        // The button was released, 
-        mPendingHoldButton = eUnknownButton;
-        [mDelegate onButtonReleased:button];
-        return;
-      }
-    }
-    
-    [mDelegate onButtonPressed:button isHold:isHoldEvent];
-  }
-}
-  
-  
-+ (io_object_t)_findDevice
-{
-  io_object_t deviceRetVal = 0;
-  
-  // Search I/O registry for devices:
-  io_iterator_t objectIter = 0;
-  IOReturn result = kIOReturnSuccess;
-  result = IOServiceGetMatchingServices(kIOMasterPortDefault, 
-                                        IOServiceMatching(sAppleRemoteDeviceName),
-                                        &objectIter);
-  if ((result == kIOReturnSuccess) && (objectIter != 0)) {
-    deviceRetVal = IOIteratorNext(objectIter);
-  }
-  
-  IOObjectRelease(objectIter);
-  
-  return deviceRetVal;
-}
-
-
-- (IOHIDDeviceInterface **)_createInterface:(io_object_t)aDevice
-{
-  IOHIDDeviceInterface **iodevice = NULL;
-  
-  IOCFPlugInInterface **pluginInterface = [self _getPluginInterface:aDevice];
-  if (pluginInterface != NULL) {
-    HRESULT pluginResult;
-    pluginResult = (*pluginInterface)->QueryInterface(pluginInterface,
-                                                      CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID),
-                                                      (LPVOID *)&iodevice);
-  }
-  
-  return iodevice;
-}
-
-
-- (IOCFPlugInInterface **)_getPluginInterface:(io_object_t)aDevice
-{
-  IOReturn result = kIOReturnSuccess;
-  SInt32 score = 0;
-  IOCFPlugInInterface **pluginInterface = NULL;
-  
-  result = IOCreatePlugInInterfaceForService(aDevice, 
-                                             kIOHIDDeviceUserClientTypeID, 
-                                             kIOCFPlugInInterfaceID, 
-                                             &pluginInterface, 
-                                             &score);
-  if (result != kIOReturnSuccess) {
-#if LOG_IO_ERRORS
-    NSLog(@"Couldn't get a plugin interface!");
-#endif
-    return NULL;
-  }
-  
-  return pluginInterface;
-}
-
-
-- (NSArray *)_readDeviceCookies:(IOHIDDeviceInterface **)aDeviceInterface
-{
-  IOHIDDeviceInterface122 **handle = (IOHIDDeviceInterface122 **)aDeviceInterface;
-  if (!handle || !(*handle))
-    return nil;
-  
-  NSMutableArray *cookieList = [[NSMutableArray alloc] init];
-  
-  IOReturn result = kIOReturnSuccess;
-  NSArray *elements = nil;
-  result = (*handle)->copyMatchingElements(handle, NULL, (CFArrayRef *)&elements);
-  if (result == kIOReturnSuccess) {
-    NSDictionary *curElementDict = nil;
-    NSEnumerator *elementsEnum = [elements objectEnumerator];
-    while ((curElementDict = [elementsEnum nextObject])) {
-      // Before adding a cookie, make sure the entry has at least 3 things:
-      // Cookie:
-      id cookie = 
-        [curElementDict valueForKey:(NSString *)CFSTR(kIOHIDElementCookieKey)];
-      if (!cookie || ![cookie isKindOfClass:[NSNumber class]] || cookie == 0)
-        continue;
-      
-      // Usage:
-      id usage = 
-        [curElementDict valueForKey:(NSString *)CFSTR(kIOHIDElementUsageKey)];
-      if (!usage || ![usage isKindOfClass:[NSNumber class]])
-        continue;
-      
-      // Usage Page:
-      id usagePage =
-        [curElementDict valueForKey:(NSString *)CFSTR(kIOHIDElementUsagePageKey)];
-      if (!usagePage || ![usagePage isKindOfClass:[NSNumber class]])
-        continue;
-      
-      [cookieList addObject:cookie];
-    }
-  }
-  
-  return cookieList;
-}
-
-
-- (EAppleRemoteButton)_buttonForCookie:(NSString *)aCookieStr 
-                           isHoldEvent:(BOOL *)aIsHoldEvent
-{
-  EAppleRemoteButton buttonType = eUnknownButton;
-  if (!aIsHoldEvent)
-    return  buttonType;
-  
-  NSDictionary *cookiesDict = [self _getCookieButtonsDict];
-  
-  id buttonNum = [cookiesDict valueForKey:aCookieStr];
-  if (buttonNum) {
-    unsigned int buttonCode = [buttonNum intValue];
-    if (buttonCode > eLeftButton) {
-      // Hold events are not defined in |EAppleRemoteButton|.
-      switch (buttonCode) {
-        case RIGHT_BUTTON_HOLD:
-          buttonType = eRightButton;
-          *aIsHoldEvent = YES;
-          break;
-        case LEFT_BUTTON_HOLD:
-          buttonType = eLeftButton;
-          *aIsHoldEvent = YES;
-          break;
-          
-        // There is not any callback (up events) for the "Menu" and "Play"
-        // buttons - just send those events with out the hold flag.
-        case MENU_BUTTON_HOLD:
-          buttonType = eMenuButton;
-          *aIsHoldEvent = NO;
-          break;
-        case PLAY_BUTTON_HOLD:
-          buttonType = ePlayButton;
-          *aIsHoldEvent = NO;
-          break;
-      }
-    }
-    else {
-      buttonType = (EAppleRemoteButton) [buttonNum intValue];
-    }
-  }
-  
-  return buttonType;
-}
-
-
-- (NSDictionary *)_getCookieButtonsDict
-{
-  // make this static?
-  static NSDictionary *cookiesDict = nil;
-  // Button cookies are different on Tiger and Leopard.
-  if (!cookiesDict) {
-    NSArray *cookies = nil;
-    NSArray *buttons = 
-      [NSArray arrayWithObjects:[NSNumber numberWithInt:ePlusButton],
-                                [NSNumber numberWithInt:eMinusButton],
-                                [NSNumber numberWithInt:eMenuButton],
-                                [NSNumber numberWithInt:ePlayButton],
-                                [NSNumber numberWithInt:eRightButton],
-                                [NSNumber numberWithInt:eLeftButton],
-                                [NSNumber numberWithInt:RIGHT_BUTTON_HOLD],
-                                [NSNumber numberWithInt:LEFT_BUTTON_HOLD],
-                                [NSNumber numberWithInt:MENU_BUTTON_HOLD],
-                                [NSNumber numberWithInt:PLAY_BUTTON_HOLD],
-                                nil];
-    
-    if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_4) {
-      // 10.4.x Tiger
-      cookies = 
-        [NSArray arrayWithObjects:@"14_12_11_6_", 
-                                  @"14_13_11_6_", 
-                                  @"14_7_6_14_7_6_",
-                                  @"14_8_6_14_8_6_",
-                                  @"14_9_6_14_9_6_",
-                                  @"14_10_6_14_10_6_",
-                                  @"14_6_4_2_",
-                                  @"14_6_3_2_",
-                                  @"14_6_14_6_",
-                                  @"18_14_6_18_14_6_",
-                                  nil];
-    }
-    else {
-      // 10.5.x Leopard
-      cookies = 
-        [NSArray arrayWithObjects:@"31_29_28_19_18_", 
-                                  @"31_30_28_19_18_", 
-                                  @"31_20_19_18_31_20_19_18_",
-                                  @"31_21_19_18_31_21_19_18_",
-                                  @"31_22_19_18_31_22_19_18_",
-                                  @"31_23_19_18_31_23_19_18_",
-                                  @"31_19_18_4_2_",
-                                  @"31_19_18_3_2_",
-                                  @"31_19_18_31_19_18_",
-                                  @"35_31_19_18_35_31_19_18_",
-                                  nil];
-    }
-    
-    cookiesDict = [[NSDictionary alloc] initWithObjects:buttons forKeys:cookies];
-  }
-  
-  return cookiesDict;
-}
-
-
-@end

components/macremote/src/sbAppleRemoteModule.mm

-/*
- //
- // BEGIN SONGBIRD GPL
- //
- // This file is part of the Songbird web player.
- //
- // Copyright(c) 2005-2008 POTI, Inc.
- // http://songbirdnest.com
- //
- // This file may be licensed under the terms of of the
- // GNU General Public License Version 2 (the "GPL").
- //
- // Software distributed under the License is distributed
- // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
- // express or implied. See the GPL for the specific language
- // governing rights and limitations.
- //
- // You should have received a copy of the GPL along with this
- // program. If not, go to http://www.gnu.org/licenses/gpl.html
- // or write to the Free Software Foundation, Inc.,
- // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- //
- // END SONGBIRD GPL
- //
- */
-
-#include "nsIGenericFactory.h"
-#include "sbAppleRemoteService.h"
-
-
-// 
-// Componet Defines
-//
-/* AFCF7797-8923-4033-A431-359A7C7334F4 */
-#define SB_MACREMOTECONTROLSERVICE_CID \
-{ 0xAFCF7797, 0x8923, 0x4033, \
-{ 0xA4, 0x31, 0x35, 0x9A, 0x7C, 0x73, 0x34, 0xF4 } }
-
-#define SB_MACREMOTECONTROLSERVICE_CONTRACTID \ 
-"@songbirdnest.com/mac-remote-service;1"
-
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(sbAppleRemoteService)
-
-static const nsModuleComponentInfo components[] =
-{
-  {
-    "Songbird Mac Remote Control Service",
-    SB_MACREMOTECONTROLSERVICE_CID,
-    SB_MACREMOTECONTROLSERVICE_CONTRACTID,
-    sbAppleRemoteServiceConstructor
-  }
-};
-
-NS_IMPL_NSGETMODULE(sbMacRemoteControllerModule, components)

components/macremote/src/sbAppleRemoteService.h

-/*
- //
- // BEGIN SONGBIRD GPL
- // 
- // This file is part of the Songbird web player.
- //
- // Copyright(c) 2005-2008 POTI, Inc.
- // http://songbirdnest.com
- // 
- // This file may be licensed under the terms of of the
- // GNU General Public License Version 2 (the "GPL").
- // 
- // Software distributed under the License is distributed 
- // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
- // express or implied. See the GPL for the specific language 
- // governing rights and limitations.
- //
- // You should have received a copy of the GPL along with this 
- // program. If not, go to http://www.gnu.org/licenses/gpl.html
- // or write to the Free Software Foundation, Inc., 
- // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- // 
- // END SONGBIRD GPL
- //
- */
-
-#ifndef sbAppleRemoteService_h_
-#define sbAppleRemoteService_h_
-
-#include <nsCOMArray.h>
-#include <nsServiceManagerUtils.h>
-#include "sbIMacRemoteControl.h"
-#include "sbIMediacorePlaybackControl.h"
-#include "sbIMediacoreSequencer.h"
-#include "sbIMediacoreVolumeControl.h"
-
-@class AppleRemoteDelegate;
-
-//
-// Apple Remote control service implementation:
-//
-class sbAppleRemoteService : public sbIAppleRemoteService
-{
-public:
-  sbAppleRemoteService();
-  virtual ~sbAppleRemoteService();
-  
-  NS_DECL_ISUPPORTS
-  NS_DECL_SBIAPPLEREMOTESERVICE
-  
-  NS_IMETHOD OnPlayButtonPressed();
-  NS_IMETHOD OnMenuButtonPressed();
-  NS_IMETHOD OnVolumeUpPressed();
-  NS_IMETHOD OnVolumeDownPressed();
-  NS_IMETHOD OnNextTrackPressed();
-  NS_IMETHOD OnNextTrackReleased();
-  NS_IMETHOD OnPrevTrackPressed();
-  NS_IMETHOD OnPrevTrackReleased();
-
-protected:
-  NS_IMETHOD GetPlaybackControl(sbIMediacorePlaybackControl **aPlaybackControl);
-  NS_IMETHOD GetSequencer(sbIMediacoreSequencer **aSequencer);
-  NS_IMETHOD GetVolumeControl(sbIMediacoreVolumeControl **aVolControl);
-
-private:
-  AppleRemoteDelegate *mDelegate;  // strong
-};
-
-#endif  // sbAppleRemoteService_h_

components/macremote/src/sbAppleRemoteService.mm

-/*
- //
- // BEGIN SONGBIRD GPL
- // 
- // This file is part of the Songbird web player.
- //
- // Copyright(c) 2005-2008 POTI, Inc.
- // http://songbirdnest.com
- // 
- // This file may be licensed under the terms of of the
- // GNU General Public License Version 2 (the "GPL").
- // 
- // Software distributed under the License is distributed 
- // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
- // express or implied. See the GPL for the specific language 
- // governing rights and limitations.
- //
- // You should have received a copy of the GPL along with this 
- // program. If not, go to http://www.gnu.org/licenses/gpl.html
- // or write to the Free Software Foundation, Inc., 
- // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- // 
- // END SONGBIRD GPL
- //
- */
-
-#include "sbAppleRemoteService.h"
-
-#import "SBAppleRemoteListener.h"
-#include "nsCOMPtr.h"
-#include "sbIMediacoreManager.h"
-#include "sbIMediacoreStatus.h"
-
-#define MAX_VOLUME  1
-
-@interface AppleRemoteDelegate : NSObject
-{
-  SBAppleRemoteListener* mAppleRemote;
-  sbAppleRemoteService *mOwner;  // weak
-}
-
-- (id)initWithCallback:(sbAppleRemoteService *)aCallback;
-
-- (void)startListening;
-- (void)stopListening;
-
-@end
-
-
-@implementation AppleRemoteDelegate
-
-- (id)initWithCallback:(sbAppleRemoteService *)aCallback
-{
-  if ((self = [super init])) {
-    mAppleRemote = [[SBAppleRemoteListener alloc] initWithDelegate: self];
-    mOwner = aCallback;
-  }
-  
-  return self;
-}
-
-- (void)dealloc
-{
-  [mAppleRemote release];
-  [super dealloc];
-}
-
-- (void)startListening
-{
-  [mAppleRemote startListening];
-}
-
-- (void)stopListening
-{
-  [mAppleRemote stopListening];
-}
-
-- (void)onButtonPressed:(EAppleRemoteButton)aButton isHold:(BOOL)aIsHold
-{
-  // Process this event right away
-  if (!aIsHold) {
-    switch (aButton) {
-      case ePlusButton:
-        mOwner->OnVolumeUpPressed();
-        break;
-      case eMinusButton:
-        mOwner->OnVolumeDownPressed();
-        break;
-      case eMenuButton:
-        mOwner->OnMenuButtonPressed();
-        break;
-      case ePlayButton:
-        mOwner->OnPlayButtonPressed();
-        break;
-      case eRightButton:
-        mOwner->OnNextTrackReleased();
-        break;
-      case eLeftButton:
-        mOwner->OnPrevTrackReleased();
-        break;      
-    }
-  }
-  else {
-  }
-}
-
-- (void)onButtonReleased:(EAppleRemoteButton)aButton
-{
-  // TODO: support this...
-}
-
-@end
-
-
-//////////////////////////////////////////////////////////////////////////////
-
-
-NS_IMPL_ISUPPORTS1(sbAppleRemoteService, sbIAppleRemoteService)
-
-sbAppleRemoteService::sbAppleRemoteService()
-{
-  mDelegate = [[AppleRemoteDelegate alloc] initWithCallback:this];
-}
-
-sbAppleRemoteService::~sbAppleRemoteService()
-{
-  [mDelegate release];
-}
-
-NS_IMETHODIMP
-sbAppleRemoteService::StartListening()
-{
-  [mDelegate startListening];
-  return NS_OK;
-}
-
-NS_IMETHODIMP 
-sbAppleRemoteService::StopListening()
-{
-  [mDelegate stopListening];
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-sbAppleRemoteService::GetIsSupported(PRBool *aIsSupported)
-{
-  NS_ENSURE_ARG_POINTER(aIsSupported);
-  *aIsSupported = [SBAppleRemoteListener isRemoteAvailable];
-  return NS_OK;
-}
-
-NS_IMETHODIMP 
-sbAppleRemoteService::OnPlayButtonPressed()
-{
-  nsresult rv;
-  nsCOMPtr<sbIMediacoreManager> manager = 
-    do_GetService("@songbirdnest.com/Songbird/Mediacore/Manager;1", &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<sbIMediacoreStatus> status;
-  rv = manager->GetStatus(getter_AddRefs(status));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<sbIMediacorePlaybackControl> playbackControl;
-  rv = manager->GetPlaybackControl(getter_AddRefs(playbackControl));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRUint32 state;
-  rv = status->GetState(&state);
-  NS_ENSURE_SUCCESS(rv, rv);
-  
-  if (state == sbIMediacoreStatus::STATUS_PAUSED) {
-    rv = playbackControl->Play();
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-  else if (state == sbIMediacoreStatus::STATUS_PLAYING ||
-           state == sbIMediacoreStatus::STATUS_BUFFERING)
-  {
-    rv = playbackControl->Pause();
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP 
-sbAppleRemoteService::OnMenuButtonPressed()
-{
-  // XXXkreeger Show the library?
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP 
-sbAppleRemoteService::OnVolumeUpPressed()
-{
-  nsresult rv;
-  nsCOMPtr<sbIMediacoreVolumeControl> volControl;
-  rv = GetVolumeControl(getter_AddRefs(volControl));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  double curVolume;
-  rv = volControl->GetVolume(&curVolume);
-  NS_ENSURE_SUCCESS(rv, rv);
-  
-  curVolume += 0.05;
-  if (curVolume > MAX_VOLUME)
-    curVolume = MAX_VOLUME;
-
-  return volControl->SetVolume(curVolume);
-}
-
-NS_IMETHODIMP 
-sbAppleRemoteService::OnVolumeDownPressed()
-{
-  nsresult rv;
-  nsCOMPtr<sbIMediacoreVolumeControl> volControl;
-  rv = GetVolumeControl(getter_AddRefs(volControl));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  double curVolume;
-  rv = volControl->GetVolume(&curVolume);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  curVolume -= 0.05;
-  if (curVolume < 0.0)
-    curVolume = 0;
-
-  return volControl->SetVolume(curVolume);
-}
-
-NS_IMETHODIMP 
-sbAppleRemoteService::OnNextTrackPressed()
-{
-  // TODO: Support scanning...
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP 
-sbAppleRemoteService::OnNextTrackReleased()
-{
-  nsresult rv;
-  nsCOMPtr<sbIMediacoreSequencer> sequencer;
-  rv = GetSequencer(getter_AddRefs(sequencer));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return sequencer->Next();
-}
-
-NS_IMETHODIMP 
-sbAppleRemoteService::OnPrevTrackPressed()
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP 
-sbAppleRemoteService::OnPrevTrackReleased()
-{
-  nsresult rv;
-  nsCOMPtr<sbIMediacoreSequencer> sequencer;
-  rv = GetSequencer(getter_AddRefs(sequencer));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return sequencer->Previous();
-}
-
-NS_IMETHODIMP
-sbAppleRemoteService::GetPlaybackControl(sbIMediacorePlaybackControl **aPlayCntrl)
-{
-  nsresult rv;
-  nsCOMPtr<sbIMediacoreManager> manager =
-    do_GetService("@songbirdnest.com/Songbird/Mediacore/Manager;1", &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-  
-  return manager->GetPlaybackControl(aPlayCntrl); 
-}
-
-NS_IMETHODIMP
-sbAppleRemoteService::GetSequencer(sbIMediacoreSequencer **aSequencer)