app_list_service.h revision 3551c9c881056c480085172ff9840cab31610854
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" 113551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "base/callback_forward.h" 122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/compiler_specific.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: 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Get the AppListService for the current platform and desktop type. 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static AppListService* Get(); 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Call Init for all AppListService instances on this platform. 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static void InitAll(Profile* initial_profile); 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static void RegisterPrefs(PrefRegistrySimple* registry); 372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 38ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch static void RecordShowTimings(const CommandLine& command_line); 39ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // Indicates that |callback| should be called next time the app list is 413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) // painted. 423551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) virtual void SetAppListNextPaintCallback(const base::Closure& callback) = 0; 433551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 44ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Perform Chrome first run logic. This is executed before Chrome's threads 45ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // have been created. 46ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void HandleFirstRun() = 0; 47ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 4890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) virtual base::FilePath GetProfilePath( 49a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) const base::FilePath& user_data_dir) = 0; 50ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void SetProfilePath(const base::FilePath& profile_path) = 0; 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Show the app list for the profile configured in the user data dir for the 53ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // current browser process. 54ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void Show() = 0; 5590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 56ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch // Create the app list UI, and maintain its state, but do not show it. 57ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch virtual void CreateForProfile(Profile* requested_profile) = 0; 58ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch 59ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Show the app list for the given profile. If it differs from the profile the 60ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // app list is currently showing, repopulate the app list and save the new 61ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // profile to local prefs as the default app list profile. 62ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void ShowForProfile(Profile* requested_profile) = 0; 632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Dismiss the app list. 65a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual void DismissAppList() = 0; 66a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Get the profile the app list is currently showing. 68a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual Profile* GetCurrentAppListProfile() = 0; 692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns true if the app list is visible. 71a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual bool IsAppListVisible() const = 0; 722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 73c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Enable the app list. What this does specifically will depend on the host 74c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // operating system and shell. 757dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual void EnableAppList(Profile* initial_profile) = 0; 762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 77868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Get the window the app list is in, or NULL if the app list isn't visible. 78868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual gfx::NativeWindow GetAppListWindow() = 0; 79868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Exposed to allow testing of the controller delegate. 81a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual AppListControllerDelegate* CreateControllerDelegate() = 0; 82a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) protected: 842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) AppListService() {} 852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual ~AppListService() {} 862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Do any once off initialization needed for the app list. 88a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual void Init(Profile* initial_profile) = 0; 892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private: 912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(AppListService); 922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ 95