Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / app_list / app_list_view_delegate.h
index 264c4f3..60026af 100644 (file)
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/observer_list.h"
+#include "base/scoped_observer.h"
 #include "chrome/browser/profiles/profile_info_cache_observer.h"
+#include "chrome/browser/search/hotword_client.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
 #include "chrome/browser/ui/app_list/chrome_signin_delegate.h"
 #include "chrome/browser/ui/app_list/start_page_observer.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
+#include "components/signin/core/browser/signin_manager_base.h"
 #include "ui/app_list/app_list_view_delegate.h"
-#include "ui/app_list/speech_ui_model.h"
 
 class AppListControllerDelegate;
 class Profile;
 
 namespace app_list {
 class SearchController;
+class SpeechUIModel;
 }
 
 namespace base {
 class FilePath;
 }
 
-namespace content {
-class NotificationDetails;
-class NotificationSource;
-}
-
 namespace gfx {
 class ImageSkia;
 }
@@ -46,16 +43,16 @@ class AppSyncUIStateWatcher;
 
 class AppListViewDelegate : public app_list::AppListViewDelegate,
                             public app_list::StartPageObserver,
-                            public content::NotificationObserver,
-                            public ProfileInfoCacheObserver {
+                            public HotwordClient,
+                            public ProfileInfoCacheObserver,
+                            public SigninManagerBase::Observer,
+                            public SigninManagerFactory::Observer {
  public:
   AppListViewDelegate(Profile* profile,
                       AppListControllerDelegate* controller);
   virtual ~AppListViewDelegate();
 
  private:
-  // Registers the current profile for notifications.
-  void RegisterForNotifications();
   // Updates the app list's current profile and ProfileMenuItems.
   void OnProfileChanged();
 
@@ -71,6 +68,7 @@ class AppListViewDelegate : public app_list::AppListViewDelegate,
   virtual void StartSearch() OVERRIDE;
   virtual void StopSearch() OVERRIDE;
   virtual void OpenSearchResult(app_list::SearchResult* result,
+                                bool auto_launch,
                                 int event_flags) OVERRIDE;
   virtual void InvokeSearchResultAction(app_list::SearchResult* result,
                                         int action_index,
@@ -90,6 +88,7 @@ class AppListViewDelegate : public app_list::AppListViewDelegate,
   virtual content::WebContents* GetStartPageContents() OVERRIDE;
   virtual content::WebContents* GetSpeechRecognitionContents() OVERRIDE;
   virtual const Users& GetUsers() const OVERRIDE;
+  virtual bool ShouldCenterWindow() const OVERRIDE;
   virtual void AddObserver(
       app_list::AppListViewDelegateObserver* observer) OVERRIDE;
   virtual void RemoveObserver(
@@ -102,10 +101,19 @@ class AppListViewDelegate : public app_list::AppListViewDelegate,
   virtual void OnSpeechRecognitionStateChanged(
       app_list::SpeechRecognitionState new_state) OVERRIDE;
 
-  // Overridden from content::NotificationObserver:
-  virtual void Observe(int type,
-                       const content::NotificationSource& source,
-                       const content::NotificationDetails& details) OVERRIDE;
+  // Overridden from HotwordClient:
+  virtual void OnHotwordStateChanged(bool started) OVERRIDE;
+  virtual void OnHotwordRecognized() OVERRIDE;
+
+  // Overridden from SigninManagerFactory::Observer:
+  virtual void SigninManagerCreated(SigninManagerBase* manager) OVERRIDE;
+  virtual void SigninManagerShutdown(SigninManagerBase* manager) OVERRIDE;
+
+  // Overridden from SigninManagerBase::Observer:
+  virtual void GoogleSigninFailed(const GoogleServiceAuthError& error) OVERRIDE;
+  virtual void GoogleSigninSucceeded(const std::string& username,
+                                     const std::string& password) OVERRIDE;
+  virtual void GoogleSignedOut(const std::string& username) OVERRIDE;
 
   // Overridden from ProfileInfoCacheObserver:
   virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE;
@@ -125,13 +133,12 @@ class AppListViewDelegate : public app_list::AppListViewDelegate,
   // if |profile_| changes.
   app_list::AppListModel* model_;
 
-  app_list::SpeechUIModel speech_ui_;
+  scoped_ptr<app_list::SpeechUIModel> speech_ui_;
 
   base::TimeDelta auto_launch_timeout_;
 
   Users users_;
 
-  content::NotificationRegistrar registrar_;
   ChromeSigninDelegate signin_delegate_;
 #if defined(USE_ASH)
   scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_;
@@ -139,6 +146,10 @@ class AppListViewDelegate : public app_list::AppListViewDelegate,
 
   ObserverList<app_list::AppListViewDelegateObserver> observers_;
 
+  // Used to track the SigninManagers that this instance is observing so that
+  // this instance can be removed as an observer on its destruction.
+  ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_;
+
   DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate);
 };