12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <string> 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/basictypes.h" 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/compiler_specific.h" 121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "chrome/browser/ui/host_desktop.h" 13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "ui/gfx/native_widget_types.h" 142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class AppListControllerDelegate; 1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class CommandLine; 172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class PrefRegistrySimple; 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class Profile; 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace base { 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class FilePath; 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace gfx { 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ImageSkia; 262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 28a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)class AppListService { 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public: 301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Get the AppListService for the current platform and specified 311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // |desktop_type|. 321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) static AppListService* Get(chrome::HostDesktopType desktop_type); 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Call Init for all AppListService instances on this platform. 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static void InitAll(Profile* initial_profile); 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static void RegisterPrefs(PrefRegistrySimple* registry); 382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 39ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch static void RecordShowTimings(const CommandLine& command_line); 40ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // Indicates that |callback| should be called next time the app list is 423551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // painted. 43f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual void SetAppListNextPaintCallback(void (*callback)()) = 0; 443551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 45ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Perform Chrome first run logic. This is executed before Chrome's threads 46ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // have been created. 47ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void HandleFirstRun() = 0; 48ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 4990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) virtual base::FilePath GetProfilePath( 50a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) const base::FilePath& user_data_dir) = 0; 51ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void SetProfilePath(const base::FilePath& profile_path) = 0; 522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 53ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Show the app list for the profile configured in the user data dir for the 54ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // current browser process. 55ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void Show() = 0; 5690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 57ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch // Create the app list UI, and maintain its state, but do not show it. 58ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch virtual void CreateForProfile(Profile* requested_profile) = 0; 59ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch 60ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Show the app list for the given profile. If it differs from the profile the 61ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // app list is currently showing, repopulate the app list and save the new 62ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // profile to local prefs as the default app list profile. 63ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void ShowForProfile(Profile* requested_profile) = 0; 642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Dismiss the app list. 66a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual void DismissAppList() = 0; 67a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Get the profile the app list is currently showing. 69a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual Profile* GetCurrentAppListProfile() = 0; 702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns true if the app list is visible. 72a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual bool IsAppListVisible() const = 0; 732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 74c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Enable the app list. What this does specifically will depend on the host 75c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // operating system and shell. 767dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual void EnableAppList(Profile* initial_profile) = 0; 772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 78868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Get the window the app list is in, or NULL if the app list isn't visible. 79868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual gfx::NativeWindow GetAppListWindow() = 0; 80868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 81f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Returns a pointer to the platform specific AppListControllerDelegate. 82f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual AppListControllerDelegate* GetControllerDelegate() = 0; 83a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) protected: 852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) AppListService() {} 862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual ~AppListService() {} 872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Do any once off initialization needed for the app list. 89a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual void Init(Profile* initial_profile) = 0; 902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private: 922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(AppListService); 932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ 96