Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: chrome/browser/ui/webui/aura/app_list_ui.cc

Issue 8747021: [Aura] Polish app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: set tile-page-scrollbar color Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/aura/app_list_ui.h ('k') | chrome/browser/ui/webui/aura/app_list_ui_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/aura/app_list_ui.cc
diff --git a/chrome/browser/ui/webui/aura/app_list_ui.cc b/chrome/browser/ui/webui/aura/app_list_ui.cc
index 574a0aac36b4fb8950001f65c58dc797f01766e2..1cc36b36cd3a68e7968801de575bdf90cbadac68 100644
--- a/chrome/browser/ui/webui/aura/app_list_ui.cc
+++ b/chrome/browser/ui/webui/aura/app_list_ui.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
+#include "chrome/browser/ui/webui/aura/app_list_ui_delegate.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
@@ -76,10 +77,49 @@ ChromeWebUIDataSource* CreateAppListUIHTMLSource(PrefService* prefs) {
return source;
}
+class AppListHandler : public WebUIMessageHandler {
+ public:
+ AppListHandler() {}
+ virtual ~AppListHandler() {}
+
+ // WebUIMessageHandler
+ virtual void RegisterMessages() OVERRIDE;
+
+ private:
+ AppListUI* app_list_ui() const {
+ return static_cast<AppListUI*>(web_ui_);
+ }
+
+ void HandleClose(const base::ListValue* args);
+ void HandleAppsLoaded(const base::ListValue* args);
+
+ DISALLOW_COPY_AND_ASSIGN(AppListHandler);
+};
+
+void AppListHandler::RegisterMessages() {
+ web_ui_->RegisterMessageCallback("close",
+ base::Bind(&AppListHandler::HandleClose, base::Unretained(this)));
+ web_ui_->RegisterMessageCallback("onAppsLoaded",
+ base::Bind(&AppListHandler::HandleAppsLoaded, base::Unretained(this)));
+}
+
+void AppListHandler::HandleClose(const base::ListValue* args) {
+ if (app_list_ui()->delegate())
+ app_list_ui()->delegate()->Close();
+}
+
+void AppListHandler::HandleAppsLoaded(const base::ListValue* args) {
+ if (app_list_ui()->delegate())
+ app_list_ui()->delegate()->OnAppsLoaded();
+}
+
} // namespace
AppListUI::AppListUI(TabContents* contents)
- : ChromeWebUI(contents) {
+ : ChromeWebUI(contents),
+ delegate_(NULL) {
+ AddMessageHandler((new AppListHandler)->Attach(this));
+
ExtensionService* service = GetProfile()->GetExtensionService();
if (service)
AddMessageHandler((new AppLauncherHandler(service))->Attach(this));
« no previous file with comments | « chrome/browser/ui/webui/aura/app_list_ui.h ('k') | chrome/browser/ui/webui/aura/app_list_ui_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698