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 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
11 #include "extensions/browser/event_router.h" | 11 #include "extensions/browser/event_router.h" |
12 #include "extensions/browser/extension_system.h" | 12 #include "extensions/browser/extension_system.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 void BroadcastEvent(content::BrowserContext* context, | 18 void BroadcastEvent(content::BrowserContext* context, |
19 events::HistogramValue histogram_value, | 19 events::HistogramValue histogram_value, |
20 const std::string& event_name) { | 20 const std::string& event_name) { |
21 if (context && EventRouter::Get(context)) { | 21 if (context && EventRouter::Get(context)) { |
22 scoped_ptr<base::ListValue> args(new base::ListValue()); | 22 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
23 scoped_ptr<Event> event( | 23 std::unique_ptr<Event> event( |
24 new Event(histogram_value, event_name, std::move(args))); | 24 new Event(histogram_value, event_name, std::move(args))); |
25 EventRouter::Get(context)->BroadcastEvent(std::move(event)); | 25 EventRouter::Get(context)->BroadcastEvent(std::move(event)); |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 MediaPlayerEventRouter::MediaPlayerEventRouter(content::BrowserContext* context) | 31 MediaPlayerEventRouter::MediaPlayerEventRouter(content::BrowserContext* context) |
32 : browser_context_(context) {} | 32 : browser_context_(context) {} |
33 | 33 |
(...skipping 10 matching lines...) Expand all Loading... |
44 "mediaPlayerPrivate.onPrevTrack"); | 44 "mediaPlayerPrivate.onPrevTrack"); |
45 } | 45 } |
46 | 46 |
47 void MediaPlayerEventRouter::NotifyTogglePlayState() { | 47 void MediaPlayerEventRouter::NotifyTogglePlayState() { |
48 BroadcastEvent(browser_context_, | 48 BroadcastEvent(browser_context_, |
49 events::MEDIA_PLAYER_PRIVATE_ON_TOGGLE_PLAY_STATE, | 49 events::MEDIA_PLAYER_PRIVATE_ON_TOGGLE_PLAY_STATE, |
50 "mediaPlayerPrivate.onTogglePlayState"); | 50 "mediaPlayerPrivate.onTogglePlayState"); |
51 } | 51 } |
52 | 52 |
53 } // namespace extensions | 53 } // namespace extensions |
OLD | NEW |