OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/app_list/launcher_page_event_dispatcher.h" |
| 6 |
| 7 #include "base/values.h" |
| 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/common/extensions/api/launcher_page.h" |
| 10 #include "extensions/browser/event_router.h" |
| 11 |
| 12 namespace OnTransitionChanged = |
| 13 extensions::api::launcher_page::OnTransitionChanged; |
| 14 |
| 15 namespace app_list { |
| 16 |
| 17 LauncherPageEventDispatcher::LauncherPageEventDispatcher( |
| 18 Profile* profile, |
| 19 const std::string& extension_id) |
| 20 : profile_(profile), extension_id_(extension_id) { |
| 21 } |
| 22 |
| 23 LauncherPageEventDispatcher::~LauncherPageEventDispatcher() { |
| 24 } |
| 25 |
| 26 void LauncherPageEventDispatcher::ProgressChanged(double progress) { |
| 27 SendEventToLauncherPage(OnTransitionChanged::kEventName, |
| 28 OnTransitionChanged::Create(progress)); |
| 29 } |
| 30 |
| 31 void LauncherPageEventDispatcher::SendEventToLauncherPage( |
| 32 const std::string& event_name, |
| 33 scoped_ptr<base::ListValue> args) { |
| 34 scoped_ptr<extensions::Event> event( |
| 35 new extensions::Event(event_name, args.Pass())); |
| 36 extensions::EventRouter::Get(profile_) |
| 37 ->DispatchEventToExtension(extension_id_, event.Pass()); |
| 38 } |
| 39 |
| 40 } // namespace app_list |
OLD | NEW |