OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/app_list_service.h" | |
6 | |
7 #include "base/file_path.h" | |
8 | |
9 // TODO(tapted): split this into 2-3 files. | |
10 #if defined(ENABLE_APP_LIST) | |
11 | |
12 #include "base/file_util.h" | |
13 #include "base/prefs/pref_registry_simple.h" | |
14 #include "base/prefs/pref_service.h" | |
15 #include "build/build_config.h" | |
16 #include "chrome/browser/browser_process.h" | |
17 #include "chrome/browser/extensions/extension_prefs.h" | |
18 #include "chrome/common/chrome_constants.h" | |
19 #include "chrome/common/pref_names.h" | |
20 | |
21 #if defined(USE_ASH) | |
22 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" | |
23 #endif | |
24 | |
25 #if defined(OS_WIN) | |
26 #include "chrome/browser/ui/views/app_list/app_list_controller_win.h" | |
tapted
2013/02/18 07:05:39
This #include breaks DEPS! Onoz. (uploaded with --
| |
27 #endif | |
28 | |
29 #if defined(OS_MACOS) | |
30 #include "chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.h" | |
31 #endif | |
32 | |
33 #endif // defined(ENABLE_APP_LIST) | |
34 | |
35 namespace { | |
36 | |
37 class AppListServiceDisabled : public AppListService { | |
38 public: | |
39 AppListServiceDisabled() {} | |
40 | |
41 private: | |
42 DISALLOW_COPY_AND_ASSIGN(AppListServiceDisabled); | |
43 }; | |
44 | |
45 AppListServiceDisabled* GetDisabled() { | |
46 CR_DEFINE_STATIC_LOCAL(AppListServiceDisabled, disabled_instance, ()); | |
47 return &disabled_instance; | |
48 } | |
49 | |
50 } // namespace | |
51 | |
52 #if defined(ENABLE_APP_LIST) | |
53 | |
54 // static | |
55 AppListService* AppListService::Get() { | |
56 #if defined(USE_ASH) | |
57 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) | |
58 return AppListControllerAsh::GetInstance(); | |
59 #elif defined(OS_WIN) | |
60 return AppListControllerWin::GetInstance(); | |
61 #elif defined(OS_MACOS) | |
62 return AppListControllerCocoa::GetInstance(); | |
63 #else | |
64 #error "ENABLE_APP_LIST defined, but no controller available" | |
65 #endif | |
66 } | |
67 | |
68 // static | |
69 base::FilePath AppListService::GetAppListProfilePath( | |
70 const base::FilePath& user_data_dir) { | |
71 PrefService* local_state = g_browser_process->local_state(); | |
72 DCHECK(local_state); | |
73 | |
74 std::string app_list_profile; | |
75 if (local_state->HasPrefPath(prefs::kAppListProfile)) | |
76 app_list_profile = local_state->GetString(prefs::kAppListProfile); | |
77 | |
78 // If the user has no profile preference for the app launcher, default to the | |
79 // last browser profile used. | |
80 if (app_list_profile.empty() && | |
81 local_state->HasPrefPath(prefs::kProfileLastUsed)) | |
82 app_list_profile = local_state->GetString(prefs::kProfileLastUsed); | |
83 | |
84 std::string profile_path = app_list_profile.empty() ? | |
85 chrome::kInitialProfile : | |
86 app_list_profile; | |
87 | |
88 return user_data_dir.AppendASCII(profile_path); | |
89 } | |
90 | |
91 // static | |
92 void AppListService::RegisterAppListPrefs(PrefRegistrySimple* registry) { | |
93 registry->RegisterStringPref(prefs::kAppListProfile, ""); | |
94 } | |
95 | |
96 #else // !defined(ENABLE_APP_LIST) | |
97 | |
98 // static | |
99 AppListService* AppListService::Get() { | |
100 return GetDisabled(); | |
101 } | |
102 | |
103 // static | |
104 base::FilePath AppListService::GetAppListProfilePath( | |
105 const base::FilePath& user_data_dir) { | |
106 NOTREACHED(); | |
107 return base::FilePath(); | |
108 } | |
109 | |
110 // static | |
111 void AppListService::RegisterAppListPrefs(PrefRegistrySimple* registry) {} | |
112 | |
113 #endif // else defined(ENABLE_APP_LIST) | |
114 | |
115 void AppListService::Init(Profile* initial_profile) {} | |
116 | |
117 void AppListService::ShowAppList(Profile* profile) {} | |
118 | |
119 void AppListService::DismissAppList() {} | |
120 | |
121 void AppListService::SetAppListProfile( | |
122 const base::FilePath& profile_file_path) {} | |
123 | |
124 Profile* AppListService::GetCurrentAppListProfile() { return NULL; } | |
125 | |
126 bool AppListService::IsAppListVisible() const { return false; } | |
127 | |
128 void AppListService::OnBeginExtensionInstall( | |
129 Profile* profile, | |
130 const std::string& extension_id, | |
131 const std::string& extension_name, | |
132 const gfx::ImageSkia& installing_icon) {} | |
133 | |
134 void AppListService::OnDownloadProgress( | |
135 Profile* profile, | |
136 const std::string& extension_id, | |
137 int percent_downloaded) {} | |
138 | |
139 void AppListService::OnExtensionInstallFailure( | |
140 Profile* profile, | |
141 const std::string& extension_id) {} | |
142 | |
143 void AppListService::OnProfileAdded(const base::FilePath& profilePath) {} | |
144 void AppListService::OnProfileWillBeRemoved( | |
145 const base::FilePath& profile_path) {} | |
146 void AppListService::OnProfileWasRemoved(const base::FilePath& profile_path, | |
147 const string16& profile_name) {} | |
148 void AppListService::OnProfileNameChanged(const base::FilePath& profile_path, | |
149 const string16& profile_name) {} | |
150 void AppListService::OnProfileAvatarChanged( | |
151 const base::FilePath& profile_path) {} | |
OLD | NEW |