summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 16:53:02 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 16:53:02 +0000
commit3a9896c1b0694ba60546a996ed2422e12d9b5337 (patch)
treee6a25be10ae2838f7f0fcb35e3afd19b10c2dd3f /chrome/browser/ui
parentdb215301990c0c89e6029da5314520e7b2c66b29 (diff)
downloadchromium_src-3a9896c1b0694ba60546a996ed2422e12d9b5337.zip
chromium_src-3a9896c1b0694ba60546a996ed2422e12d9b5337.tar.gz
chromium_src-3a9896c1b0694ba60546a996ed2422e12d9b5337.tar.bz2
app_list: Add sync animation.
- Add a status property to AppListModel to indicate app syncing status; - Update this status when AppSyncUIState changes; - AppsGridView to hold AppListModel instead of just apps; - AppsGridView to show pulsing blocks on remaining slots on the last page when AppListModel status is syncing; BUG=129236 TEST=Verify app list showing pulsing white blocks for new user on cros. R=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/11371003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/app_list/app_list_view_delegate.cc10
-rw-r--r--chrome/browser/ui/app_list/app_list_view_delegate.h8
-rw-r--r--chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.cc30
-rw-r--r--chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h36
4 files changed, 84 insertions, 0 deletions
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc
index 56ff598..efdc66f 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -10,6 +10,10 @@
#include "chrome/browser/ui/app_list/search_builder.h"
#include "content/public/browser/user_metrics.h"
+#if defined(USE_ASH)
+#include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h"
+#endif
+
AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller)
: controller_(controller) {}
@@ -27,9 +31,15 @@ void AppListViewDelegate::SetModel(app_list::AppListModel* model) {
model->search_box(),
model->results(),
controller_.get()));
+#if defined(USE_ASH)
+ app_sync_ui_state_watcher_.reset(new AppSyncUIStateWatcher(profile, model));
+#endif
} else {
apps_builder_.reset();
search_builder_.reset();
+#if defined(USE_ASH)
+ app_sync_ui_state_watcher_.reset();
+#endif
}
}
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.h b/chrome/browser/ui/app_list/app_list_view_delegate.h
index c7bbae5..1159e9e 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.h
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.h
@@ -16,6 +16,10 @@
class AppsModelBuilder;
class SearchBuilder;
+#if defined(USE_ASH)
+class AppSyncUIStateWatcher;
+#endif
+
class AppListViewDelegate : public app_list::AppListViewDelegate {
public:
// The delegate will take ownership of the controller.
@@ -42,6 +46,10 @@ class AppListViewDelegate : public app_list::AppListViewDelegate {
scoped_ptr<SearchBuilder> search_builder_;
scoped_ptr<AppListControllerDelegate> controller_;
+#if defined(USE_ASH)
+ scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate);
};
diff --git a/chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.cc b/chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.cc
new file mode 100644
index 0000000..c791c00
--- /dev/null
+++ b/chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 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.
+
+#include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h"
+
+#include "chrome/browser/ui/ash/app_sync_ui_state.h"
+#include "ui/app_list/app_list_model.h"
+
+AppSyncUIStateWatcher::AppSyncUIStateWatcher(Profile* profile,
+ app_list::AppListModel* model)
+ : app_sync_ui_state_(AppSyncUIState::Get(profile)),
+ model_(model) {
+ if (app_sync_ui_state_) {
+ app_sync_ui_state_->AddObserver(this);
+ OnAppSyncUIStatusChanged();
+ }
+}
+
+AppSyncUIStateWatcher::~AppSyncUIStateWatcher() {
+ if (app_sync_ui_state_)
+ app_sync_ui_state_->RemoveObserver(this);
+}
+
+void AppSyncUIStateWatcher::OnAppSyncUIStatusChanged() {
+ if (app_sync_ui_state_->status() == AppSyncUIState::STATUS_SYNCING)
+ model_->SetStatus(app_list::AppListModel::STATUS_SYNCING);
+ else
+ model_->SetStatus(app_list::AppListModel::STATUS_NORMAL);
+}
diff --git a/chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h b/chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h
new file mode 100644
index 0000000..5ec74a1
--- /dev/null
+++ b/chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 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_ASH_APP_LIST_APP_SYNC_UI_STATE_WATCHER_H_
+#define CHROME_BROWSER_UI_ASH_APP_LIST_APP_SYNC_UI_STATE_WATCHER_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chrome/browser/ui/ash/app_sync_ui_state_observer.h"
+
+namespace app_list {
+class AppListModel;
+}
+
+class AppSyncUIState;
+class Profile;
+
+// AppSyncUIStateWatcher updates AppListModel status when AppSyncUIState
+// of the given profile changes.
+class AppSyncUIStateWatcher : public AppSyncUIStateObserver {
+ public:
+ AppSyncUIStateWatcher(Profile* profile, app_list::AppListModel* model);
+ virtual ~AppSyncUIStateWatcher();
+
+ private:
+ // AppSyncUIStateObserver overrides:
+ virtual void OnAppSyncUIStatusChanged() OVERRIDE;
+
+ AppSyncUIState* app_sync_ui_state_;
+ app_list::AppListModel* model_; // Owned by AppListView
+
+ DISALLOW_COPY_AND_ASSIGN(AppSyncUIStateWatcher);
+};
+
+#endif // CHROME_BROWSER_UI_ASH_APP_LIST_APP_SYNC_UI_STATE_WATCHER_H_