Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / ui / app_list / launcher_page_event_dispatcher.cc
blob2e958fb17209cad65d884dadffdc6eb44fe27ab0
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 DispatchEvent(make_scoped_ptr(new extensions::Event(
29 extensions::events::LAUNCHER_PAGE_ON_TRANSITION_CHANGED,
30 OnTransitionChanged::kEventName, OnTransitionChanged::Create(progress))));
33 void LauncherPageEventDispatcher::PopSubpage() {
34 DispatchEvent(make_scoped_ptr(
35 new extensions::Event(extensions::events::LAUNCHER_PAGE_ON_POP_SUBPAGE,
36 OnPopSubpage::kEventName, OnPopSubpage::Create())));
39 void LauncherPageEventDispatcher::DispatchEvent(
40 scoped_ptr<extensions::Event> event) {
41 extensions::EventRouter::Get(profile_)
42 ->DispatchEventToExtension(extension_id_, event.Pass());
45 } // namespace app_list