Index: chrome/browser/ui/app_list_service.cc |
diff --git a/chrome/browser/ui/app_list_service.cc b/chrome/browser/ui/app_list_service.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b6671d7cc10dd06c3144ab48ca3f2a88655285cd |
--- /dev/null |
+++ b/chrome/browser/ui/app_list_service.cc |
@@ -0,0 +1,151 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/app_list_service.h" |
+ |
+#include "base/file_path.h" |
+ |
+// TODO(tapted): split this into 2-3 files. |
+#if defined(ENABLE_APP_LIST) |
+ |
+#include "base/file_util.h" |
+#include "base/prefs/pref_registry_simple.h" |
+#include "base/prefs/pref_service.h" |
+#include "build/build_config.h" |
+#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/extensions/extension_prefs.h" |
+#include "chrome/common/chrome_constants.h" |
+#include "chrome/common/pref_names.h" |
+ |
+#if defined(USE_ASH) |
+#include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" |
+#endif |
+ |
+#if defined(OS_WIN) |
+#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 --
|
+#endif |
+ |
+#if defined(OS_MACOS) |
+#include "chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.h" |
+#endif |
+ |
+#endif // defined(ENABLE_APP_LIST) |
+ |
+namespace { |
+ |
+class AppListServiceDisabled : public AppListService { |
+ public: |
+ AppListServiceDisabled() {} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(AppListServiceDisabled); |
+}; |
+ |
+AppListServiceDisabled* GetDisabled() { |
+ CR_DEFINE_STATIC_LOCAL(AppListServiceDisabled, disabled_instance, ()); |
+ return &disabled_instance; |
+} |
+ |
+} // namespace |
+ |
+#if defined(ENABLE_APP_LIST) |
+ |
+// static |
+AppListService* AppListService::Get() { |
+#if defined(USE_ASH) |
+ if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) |
+ return AppListControllerAsh::GetInstance(); |
+#elif defined(OS_WIN) |
+ return AppListControllerWin::GetInstance(); |
+#elif defined(OS_MACOS) |
+ return AppListControllerCocoa::GetInstance(); |
+#else |
+#error "ENABLE_APP_LIST defined, but no controller available" |
+#endif |
+} |
+ |
+// static |
+base::FilePath AppListService::GetAppListProfilePath( |
+ const base::FilePath& user_data_dir) { |
+ PrefService* local_state = g_browser_process->local_state(); |
+ DCHECK(local_state); |
+ |
+ std::string app_list_profile; |
+ if (local_state->HasPrefPath(prefs::kAppListProfile)) |
+ app_list_profile = local_state->GetString(prefs::kAppListProfile); |
+ |
+ // If the user has no profile preference for the app launcher, default to the |
+ // last browser profile used. |
+ if (app_list_profile.empty() && |
+ local_state->HasPrefPath(prefs::kProfileLastUsed)) |
+ app_list_profile = local_state->GetString(prefs::kProfileLastUsed); |
+ |
+ std::string profile_path = app_list_profile.empty() ? |
+ chrome::kInitialProfile : |
+ app_list_profile; |
+ |
+ return user_data_dir.AppendASCII(profile_path); |
+} |
+ |
+// static |
+void AppListService::RegisterAppListPrefs(PrefRegistrySimple* registry) { |
+ registry->RegisterStringPref(prefs::kAppListProfile, ""); |
+} |
+ |
+#else // !defined(ENABLE_APP_LIST) |
+ |
+// static |
+AppListService* AppListService::Get() { |
+ return GetDisabled(); |
+} |
+ |
+// static |
+base::FilePath AppListService::GetAppListProfilePath( |
+ const base::FilePath& user_data_dir) { |
+ NOTREACHED(); |
+ return base::FilePath(); |
+} |
+ |
+// static |
+void AppListService::RegisterAppListPrefs(PrefRegistrySimple* registry) {} |
+ |
+#endif // else defined(ENABLE_APP_LIST) |
+ |
+void AppListService::Init(Profile* initial_profile) {} |
+ |
+void AppListService::ShowAppList(Profile* profile) {} |
+ |
+void AppListService::DismissAppList() {} |
+ |
+void AppListService::SetAppListProfile( |
+ const base::FilePath& profile_file_path) {} |
+ |
+Profile* AppListService::GetCurrentAppListProfile() { return NULL; } |
+ |
+bool AppListService::IsAppListVisible() const { return false; } |
+ |
+void AppListService::OnBeginExtensionInstall( |
+ Profile* profile, |
+ const std::string& extension_id, |
+ const std::string& extension_name, |
+ const gfx::ImageSkia& installing_icon) {} |
+ |
+void AppListService::OnDownloadProgress( |
+ Profile* profile, |
+ const std::string& extension_id, |
+ int percent_downloaded) {} |
+ |
+void AppListService::OnExtensionInstallFailure( |
+ Profile* profile, |
+ const std::string& extension_id) {} |
+ |
+void AppListService::OnProfileAdded(const base::FilePath& profilePath) {} |
+void AppListService::OnProfileWillBeRemoved( |
+ const base::FilePath& profile_path) {} |
+void AppListService::OnProfileWasRemoved(const base::FilePath& profile_path, |
+ const string16& profile_name) {} |
+void AppListService::OnProfileNameChanged(const base::FilePath& profile_path, |
+ const string16& profile_name) {} |
+void AppListService::OnProfileAvatarChanged( |
+ const base::FilePath& profile_path) {} |