OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/app_list/launcher_page_event_dispatcher.h" | 5 #include "chrome/browser/ui/app_list/launcher_page_event_dispatcher.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
9 #include "base/values.h" | 10 #include "base/values.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/common/extensions/api/launcher_page.h" | 12 #include "chrome/common/extensions/api/launcher_page.h" |
12 #include "extensions/browser/event_router.h" | 13 #include "extensions/browser/event_router.h" |
13 | 14 |
14 namespace OnTransitionChanged = | 15 namespace OnTransitionChanged = |
15 extensions::api::launcher_page::OnTransitionChanged; | 16 extensions::api::launcher_page::OnTransitionChanged; |
16 namespace OnPopSubpage = extensions::api::launcher_page::OnPopSubpage; | 17 namespace OnPopSubpage = extensions::api::launcher_page::OnPopSubpage; |
17 | 18 |
18 namespace app_list { | 19 namespace app_list { |
19 | 20 |
20 LauncherPageEventDispatcher::LauncherPageEventDispatcher( | 21 LauncherPageEventDispatcher::LauncherPageEventDispatcher( |
21 Profile* profile, | 22 Profile* profile, |
22 const std::string& extension_id) | 23 const std::string& extension_id) |
23 : profile_(profile), extension_id_(extension_id) { | 24 : profile_(profile), extension_id_(extension_id) { |
24 } | 25 } |
25 | 26 |
26 LauncherPageEventDispatcher::~LauncherPageEventDispatcher() { | 27 LauncherPageEventDispatcher::~LauncherPageEventDispatcher() { |
27 } | 28 } |
28 | 29 |
29 void LauncherPageEventDispatcher::ProgressChanged(double progress) { | 30 void LauncherPageEventDispatcher::ProgressChanged(double progress) { |
30 DispatchEvent(make_scoped_ptr(new extensions::Event( | 31 DispatchEvent(base::WrapUnique(new extensions::Event( |
31 extensions::events::LAUNCHER_PAGE_ON_TRANSITION_CHANGED, | 32 extensions::events::LAUNCHER_PAGE_ON_TRANSITION_CHANGED, |
32 OnTransitionChanged::kEventName, OnTransitionChanged::Create(progress)))); | 33 OnTransitionChanged::kEventName, OnTransitionChanged::Create(progress)))); |
33 } | 34 } |
34 | 35 |
35 void LauncherPageEventDispatcher::PopSubpage() { | 36 void LauncherPageEventDispatcher::PopSubpage() { |
36 DispatchEvent(make_scoped_ptr( | 37 DispatchEvent(base::WrapUnique( |
37 new extensions::Event(extensions::events::LAUNCHER_PAGE_ON_POP_SUBPAGE, | 38 new extensions::Event(extensions::events::LAUNCHER_PAGE_ON_POP_SUBPAGE, |
38 OnPopSubpage::kEventName, OnPopSubpage::Create()))); | 39 OnPopSubpage::kEventName, OnPopSubpage::Create()))); |
39 } | 40 } |
40 | 41 |
41 void LauncherPageEventDispatcher::DispatchEvent( | 42 void LauncherPageEventDispatcher::DispatchEvent( |
42 scoped_ptr<extensions::Event> event) { | 43 std::unique_ptr<extensions::Event> event) { |
43 extensions::EventRouter::Get(profile_) | 44 extensions::EventRouter::Get(profile_) |
44 ->DispatchEventToExtension(extension_id_, std::move(event)); | 45 ->DispatchEventToExtension(extension_id_, std::move(event)); |
45 } | 46 } |
46 | 47 |
47 } // namespace app_list | 48 } // namespace app_list |
OLD | NEW |