app_list_service.h revision ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16
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" 12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "ui/gfx/native_widget_types.h" 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class AppListControllerDelegate; 1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class CommandLine; 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class PrefRegistrySimple; 172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class Profile; 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace base { 202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class FilePath; 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace gfx { 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ImageSkia; 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 27a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)class AppListService { 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public: 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Get the AppListService for the current platform and desktop type. 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static AppListService* Get(); 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Call Init for all AppListService instances on this platform. 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static void InitAll(Profile* initial_profile); 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static void RegisterPrefs(PrefRegistrySimple* registry); 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 37ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch static void RecordShowTimings(const CommandLine& command_line); 38ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 39ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Perform Chrome first run logic. This is executed before Chrome's threads 40ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // have been created. 41ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void HandleFirstRun() = 0; 42ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 4390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) virtual base::FilePath GetProfilePath( 44a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) const base::FilePath& user_data_dir) = 0; 45ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void SetProfilePath(const base::FilePath& profile_path) = 0; 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 47ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Show the app list for the profile configured in the user data dir for the 48ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // current browser process. 49ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void Show() = 0; 5090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 51ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch // Create the app list UI, and maintain its state, but do not show it. 52ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch virtual void CreateForProfile(Profile* requested_profile) = 0; 53ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch 54ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Show the app list for the given profile. If it differs from the profile the 55ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // app list is currently showing, repopulate the app list and save the new 56ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // profile to local prefs as the default app list profile. 57ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void ShowForProfile(Profile* requested_profile) = 0; 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Dismiss the app list. 60a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual void DismissAppList() = 0; 61a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Get the profile the app list is currently showing. 63a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual Profile* GetCurrentAppListProfile() = 0; 642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns true if the app list is visible. 66a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual bool IsAppListVisible() const = 0; 672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 68c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Enable the app list. What this does specifically will depend on the host 69c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // operating system and shell. 707dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual void EnableAppList(Profile* initial_profile) = 0; 712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 72868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Get the window the app list is in, or NULL if the app list isn't visible. 73868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual gfx::NativeWindow GetAppListWindow() = 0; 74868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Exposed to allow testing of the controller delegate. 76a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual AppListControllerDelegate* CreateControllerDelegate() = 0; 77a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) protected: 792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) AppListService() {} 802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual ~AppListService() {} 812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Do any once off initialization needed for the app list. 83a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual void Init(Profile* initial_profile) = 0; 842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private: 862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(AppListService); 872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ 90