Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / app_list / launcher_page_event_dispatcher.cc
blobc1f5cb3041a04d6c3a3803f5eddb6544b807192a
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.
5 #include "chrome/browser/ui/app_list/launcher_page_event_dispatcher.h"
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"
12 namespace OnTransitionChanged =
13 extensions::api::launcher_page::OnTransitionChanged;
14 namespace OnPopSubpage = extensions::api::launcher_page::OnPopSubpage;
16 namespace app_list {
18 LauncherPageEventDispatcher::LauncherPageEventDispatcher(
19 Profile* profile,
20 const std::string& extension_id)
21 : profile_(profile), extension_id_(extension_id) {
24 LauncherPageEventDispatcher::~LauncherPageEventDispatcher() {
27 void LauncherPageEventDispatcher::ProgressChanged(double progress) {
28 SendEventToLauncherPage(OnTransitionChanged::kEventName,
29 OnTransitionChanged::Create(progress));
32 void LauncherPageEventDispatcher::PopSubpage() {
33 SendEventToLauncherPage(OnPopSubpage::kEventName, OnPopSubpage::Create());
36 void LauncherPageEventDispatcher::SendEventToLauncherPage(
37 const std::string& event_name,
38 scoped_ptr<base::ListValue> args) {
39 scoped_ptr<extensions::Event> event(
40 new extensions::Event(event_name, args.Pass()));
41 extensions::EventRouter::Get(profile_)
42 ->DispatchEventToExtension(extension_id_, event.Pass());
45 } // namespace app_list