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

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: Created 9 years, 1 month 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
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..974b874ffdaee344bf1d7e1017d41fff0b0cef4c 100644
--- a/chrome/browser/ui/webui/aura/app_list_ui.cc
+++ b/chrome/browser/ui/webui/aura/app_list_ui.cc
@@ -76,10 +76,47 @@ 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) {
+ app_list_ui()->delegate()->Close();
sky 2011/11/30 21:50:21 Might the delegate be NULL here and on 110?
xiyuan 2011/11/30 22:26:34 It should never be NULL. Added a DCHECK to catch t
+}
+
+void AppListHandler::HandleAppsLoaded(const base::ListValue* args) {
+ 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));

Powered by Google App Engine
This is Rietveld 408576698