OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_EXTENSION_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_MEDIA_PLAYER_API_H_ |
6 #define CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_EXTENSION_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_MEDIA_PLAYER_API_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
12 #include "chrome/browser/extensions/extension_function.h" | 14 #include "chrome/browser/extensions/extension_function.h" |
13 | 15 |
| 16 class Profile; |
| 17 |
| 18 namespace extensions { |
| 19 class MediaPlayerEventRouter; |
| 20 |
14 // Implements the chrome.mediaPlayerPrivate.play method. | 21 // Implements the chrome.mediaPlayerPrivate.play method. |
15 class PlayMediaplayerFunction : public SyncExtensionFunction { | 22 class PlayMediaplayerFunction : public SyncExtensionFunction { |
16 public: | 23 public: |
17 DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.play"); | 24 DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.play"); |
18 | 25 |
19 protected: | 26 protected: |
20 virtual ~PlayMediaplayerFunction() {} | 27 virtual ~PlayMediaplayerFunction() {} |
21 | 28 |
22 // SyncExtensionFunction overrides. | 29 // SyncExtensionFunction overrides. |
23 virtual bool RunImpl() OVERRIDE; | 30 virtual bool RunImpl() OVERRIDE; |
(...skipping 28 matching lines...) Expand all Loading... |
52 public: | 59 public: |
53 DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.closeWindow"); | 60 DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.closeWindow"); |
54 | 61 |
55 protected: | 62 protected: |
56 virtual ~CloseWindowMediaplayerFunction() {} | 63 virtual ~CloseWindowMediaplayerFunction() {} |
57 | 64 |
58 // SyncExtensionFunction overrides. | 65 // SyncExtensionFunction overrides. |
59 virtual bool RunImpl() OVERRIDE; | 66 virtual bool RunImpl() OVERRIDE; |
60 }; | 67 }; |
61 | 68 |
62 #endif // CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_EXTENSION_API_H_ | 69 class MediaPlayerAPI : public ProfileKeyedAPI { |
| 70 public: |
| 71 explicit MediaPlayerAPI(Profile* profile); |
| 72 virtual ~MediaPlayerAPI(); |
| 73 |
| 74 // Convenience method to get the MediaPlayerAPI for a profile. |
| 75 static MediaPlayerAPI* Get(Profile* profile); |
| 76 |
| 77 MediaPlayerEventRouter* media_player_event_router(); |
| 78 |
| 79 // ProfileKeyedAPI implementation. |
| 80 static ProfileKeyedAPIFactory<MediaPlayerAPI>* GetFactoryInstance(); |
| 81 |
| 82 private: |
| 83 friend class ProfileKeyedAPIFactory<MediaPlayerAPI>; |
| 84 |
| 85 Profile* const profile_; |
| 86 |
| 87 // ProfileKeyedAPI implementation. |
| 88 static const char* service_name() { |
| 89 return "MediaPlayerAPI"; |
| 90 } |
| 91 static const bool kServiceIsNULLWhileTesting = true; |
| 92 |
| 93 scoped_ptr<MediaPlayerEventRouter> media_player_event_router_; |
| 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAPI); |
| 96 }; |
| 97 |
| 98 } // namespace extensions |
| 99 |
| 100 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_MEDIA_PLAYER_API_H_ |
OLD | NEW |