summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/ash/app_list
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/ash/app_list
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/ash/app_list')
-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
2 files changed, 66 insertions, 0 deletions
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_