/chromium-webcl/src/chrome/browser/chromeos/extensions/media_player_api.h

https://bitbucket.org/peixuan/chromium_r197479_base · C Header · 104 lines · 62 code · 28 blank · 14 comment · 0 complexity · 05d305b5f0409d859e8bb59d054ff530 MD5 · raw file

  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_MEDIA_PLAYER_API_H_
  5. #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_MEDIA_PLAYER_API_H_
  6. #include <map>
  7. #include <string>
  8. #include <vector>
  9. #include "base/memory/scoped_ptr.h"
  10. #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
  11. #include "chrome/browser/extensions/extension_function.h"
  12. class Profile;
  13. namespace extensions {
  14. class MediaPlayerEventRouter;
  15. // Implements the chrome.mediaPlayerPrivate.play method.
  16. class MediaPlayerPrivatePlayFunction : public SyncExtensionFunction {
  17. public:
  18. DECLARE_EXTENSION_FUNCTION("mediaPlayerPrivate.play", MEDIAPLAYERPRIVATE_PLAY)
  19. protected:
  20. virtual ~MediaPlayerPrivatePlayFunction() {}
  21. // SyncExtensionFunction overrides.
  22. virtual bool RunImpl() OVERRIDE;
  23. };
  24. // Implements the chrome.mediaPlayerPrivate.getPlaylist method.
  25. class MediaPlayerPrivateGetPlaylistFunction : public SyncExtensionFunction {
  26. public:
  27. DECLARE_EXTENSION_FUNCTION("mediaPlayerPrivate.getPlaylist",
  28. MEDIAPLAYERPRIVATE_GETPLAYLIST)
  29. protected:
  30. virtual ~MediaPlayerPrivateGetPlaylistFunction() {}
  31. // SyncExtensionFunction overrides.
  32. virtual bool RunImpl() OVERRIDE;
  33. };
  34. // Implements the chrome.mediaPlayerPrivate.setWindowHeight method.
  35. class MediaPlayerPrivateSetWindowHeightFunction : public SyncExtensionFunction {
  36. public:
  37. DECLARE_EXTENSION_FUNCTION("mediaPlayerPrivate.setWindowHeight",
  38. MEDIAPLAYERPRIVATE_SETWINDOWHEIGHT)
  39. protected:
  40. virtual ~MediaPlayerPrivateSetWindowHeightFunction() {}
  41. // SyncExtensionFunction overrides.
  42. virtual bool RunImpl() OVERRIDE;
  43. };
  44. // Implements the chrome.mediaPlayerPrivate.closeWindow method.
  45. class MediaPlayerPrivateCloseWindowFunction : public SyncExtensionFunction {
  46. public:
  47. DECLARE_EXTENSION_FUNCTION("mediaPlayerPrivate.closeWindow",
  48. MEDIAPLAYERPRIVATE_CLOSEWINDOW)
  49. protected:
  50. virtual ~MediaPlayerPrivateCloseWindowFunction() {}
  51. // SyncExtensionFunction overrides.
  52. virtual bool RunImpl() OVERRIDE;
  53. };
  54. class MediaPlayerAPI : public ProfileKeyedAPI {
  55. public:
  56. explicit MediaPlayerAPI(Profile* profile);
  57. virtual ~MediaPlayerAPI();
  58. // Convenience method to get the MediaPlayerAPI for a profile.
  59. static MediaPlayerAPI* Get(Profile* profile);
  60. MediaPlayerEventRouter* media_player_event_router();
  61. // ProfileKeyedAPI implementation.
  62. static ProfileKeyedAPIFactory<MediaPlayerAPI>* GetFactoryInstance();
  63. private:
  64. friend class ProfileKeyedAPIFactory<MediaPlayerAPI>;
  65. Profile* const profile_;
  66. // ProfileKeyedAPI implementation.
  67. static const char* service_name() {
  68. return "MediaPlayerAPI";
  69. }
  70. static const bool kServiceRedirectedInIncognito = true;
  71. static const bool kServiceIsNULLWhileTesting = true;
  72. scoped_ptr<MediaPlayerEventRouter> media_player_event_router_;
  73. DISALLOW_COPY_AND_ASSIGN(MediaPlayerAPI);
  74. };
  75. } // namespace extensions
  76. #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_MEDIA_PLAYER_API_H_