Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / app_list / app_list_service_impl.h
index 6fe68ae..5ab4991 100644 (file)
 #include "chrome/browser/ui/app_list/app_list_service.h"
 #include "chrome/browser/ui/app_list/profile_loader.h"
 
+class AppListViewDelegate;
 class ProfileStore;
 
 namespace base {
 class FilePath;
 }
 
+namespace test {
+class AppListServiceImplTestApi;
+}
+
 // Parts of the AppListService implementation shared between platforms.
 class AppListServiceImpl : public AppListService,
                            public ProfileInfoCacheObserver {
@@ -34,6 +39,10 @@ class AppListServiceImpl : public AppListService,
                      PrefService* local_state,
                      scoped_ptr<ProfileStore> profile_store);
 
+  // Lazily create the Chrome AppListViewDelegate and ensure it is set to the
+  // given |profile|.
+  AppListViewDelegate* GetViewDelegate(Profile* profile);
+
   void RecordAppListLaunch();
   static void RecordAppListAppLaunch();
 
@@ -53,6 +62,10 @@ class AppListServiceImpl : public AppListService,
  protected:
   AppListServiceImpl();
 
+  // Destroy the app list. Called when the profile that the app list is showing
+  // is being deleted.
+  virtual void DestroyAppList() = 0;
+
   void InvalidatePendingProfileLoads();
   ProfileLoader& profile_loader() { return *profile_loader_; }
   const ProfileLoader& profile_loader() const { return *profile_loader_; }
@@ -63,6 +76,7 @@ class AppListServiceImpl : public AppListService,
   void PerformStartupChecks(Profile* initial_profile);
 
  private:
+  friend class test::AppListServiceImplTestApi;
   static void SendAppListStats();
 
   // Loads a profile asynchronously and calls OnProfileLoaded() when done.
@@ -78,10 +92,12 @@ class AppListServiceImpl : public AppListService,
       const base::FilePath& profile_path) OVERRIDE;
 
   scoped_ptr<ProfileStore> profile_store_;
-  base::WeakPtrFactory<AppListServiceImpl> weak_factory_;
   base::CommandLine command_line_;
   PrefService* local_state_;
   scoped_ptr<ProfileLoader> profile_loader_;
+  scoped_ptr<AppListViewDelegate> view_delegate_;
+
+  base::WeakPtrFactory<AppListServiceImpl> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl);
 };