Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / athena / home / app_list_view_delegate.cc
index 2bd79ae..c867364 100644 (file)
@@ -5,6 +5,7 @@
 #include "athena/home/app_list_view_delegate.h"
 
 #include <string>
+#include <vector>
 
 #include "athena/home/public/app_model_builder.h"
 #include "base/basictypes.h"
 #include "ui/app_list/search_result.h"
 #include "ui/app_list/speech_ui_model.h"
 #include "ui/gfx/image/image_skia.h"
+#include "ui/views/background.h"
+#include "ui/views/view.h"
 
 namespace athena {
 
+namespace {
+
+// A view to draw the logo area of app-list centered view.
+// TODO(mukai): replace this by the actual start page webview.
+class DummyLogoView : public views::View {
+ public:
+  explicit DummyLogoView(const gfx::Size& size)
+      : size_(size) {
+    set_background(views::Background::CreateSolidBackground(
+        SK_ColorLTGRAY));
+  }
+
+ private:
+  virtual gfx::Size GetPreferredSize() const OVERRIDE {
+    return size_;
+  }
+
+  const gfx::Size size_;
+
+  DISALLOW_COPY_AND_ASSIGN(DummyLogoView);
+};
+
+}
+
 AppListViewDelegate::AppListViewDelegate(AppModelBuilder* model_builder)
     : model_(new app_list::AppListModel),
       speech_ui_(new app_list::SpeechUIModel(
@@ -51,9 +78,12 @@ void AppListViewDelegate::SearchResultChanged() {
   app_list::SearchProvider* search_provider = search_providers_[0];
   std::vector<app_list::SearchResult*> results;
   search_provider->ReleaseResult(&results);
-  model_->results()->DeleteAll();
-  for (size_t i = 0; i < results.size(); ++i)
-    model_->results()->Add(results[i]);
+  if (results.empty()) {
+    model_->results()->DeleteAll();
+  } else {
+    for (size_t i = 0; i < results.size(); ++i)
+      model_->results()->Add(results[i]);
+  }
 }
 
 bool AppListViewDelegate::ForceNativeDesktop() const {
@@ -152,7 +182,12 @@ void AppListViewDelegate::ShowForProfileByPath(
 
 views::View* AppListViewDelegate::CreateStartPageWebView(
     const gfx::Size& size) {
-  return NULL;
+  return new DummyLogoView(size);
+}
+
+std::vector<views::View*> AppListViewDelegate::CreateCustomPageWebViews(
+    const gfx::Size& size) {
+  return std::vector<views::View*>();
 }
 
 bool AppListViewDelegate::IsSpeechRecognitionEnabled() {