Index: chrome/browser/ui/app_list/launcher_page_event_dispatcher_views.h |
diff --git a/chrome/browser/ui/app_list/launcher_page_event_dispatcher_views.h b/chrome/browser/ui/app_list/launcher_page_event_dispatcher_views.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ac44647165d72ac516c7822f6e2527077b392290 |
--- /dev/null |
+++ b/chrome/browser/ui/app_list/launcher_page_event_dispatcher_views.h |
@@ -0,0 +1,54 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_APP_LIST_LAUNCHER_PAGE_EVENT_DISPATCHER_VIEWS_H_ |
+#define CHROME_BROWSER_UI_APP_LIST_LAUNCHER_PAGE_EVENT_DISPATCHER_VIEWS_H_ |
+ |
+#include "base/basictypes.h" |
+#include "chrome/browser/ui/host_desktop.h" |
+#include "ui/app_list/pagination_model_observer.h" |
+#include "ui/app_list/views/app_list_main_view.h" |
+ |
+namespace base { |
+class ListValue; |
+} |
+ |
+namespace app_list { |
+ |
+class AppListMainView; |
+ |
+// A class which observes the app list and sends events to the custom launcher |
+// page. |
+class LauncherPageEventDispatcherViews : public PaginationModelObserver, |
+ public AppListMainViewObserver { |
+ public: |
+ LauncherPageEventDispatcherViews(chrome::HostDesktopType host_desktop, |
+ Profile* profile, |
+ const std::string& extension_id); |
+ ~LauncherPageEventDispatcherViews() override; |
+ |
+ // Overridden from PaginationModelObserver: |
+ void SelectedPageChanged(int old_selected, int new_selected) override; |
+ void TransitionStarted() override; |
+ void TransitionChanged() override; |
+ |
+ // Overridden from AppListMainViewObserver: |
+ void OnContentsViewCreated() override; |
+ void OnContentsViewDestroying() override; |
+ |
+ private: |
+ void SendEventToLauncherPage(const std::string& event_name, |
+ scoped_ptr<base::ListValue> args); |
+ |
+ Profile* profile_; |
+ std::string extension_id_; |
+ |
+ AppListMainView* main_view_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(LauncherPageEventDispatcherViews); |
+}; |
+ |
+} // namespace app_list |
+ |
+#endif // CHROME_BROWSER_UI_APP_LIST_LAUNCHER_PAGE_EVENT_DISPATCHER_VIEWS_H_ |