diff options
author | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 13:18:36 +0000 |
---|---|---|
committer | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 13:18:36 +0000 |
commit | d7a322e473480a23090a6f864f9b0d79e8a7702a (patch) | |
tree | fd0f8ca937096991487d0cbbaaba141beace003c /apps/app_launcher.cc | |
parent | 1ce9bfec9248026c844218c5e340a608af884ad9 (diff) | |
download | chromium_src-d7a322e473480a23090a6f864f9b0d79e8a7702a.zip chromium_src-d7a322e473480a23090a6f864f9b0d79e8a7702a.tar.gz chromium_src-d7a322e473480a23090a6f864f9b0d79e8a7702a.tar.bz2 |
Remove --show-app-list-shortcut flag and implement new app launcher enable logic.
The app launcher now adds itself to the start menu on the first run of chrome
past this patch.
The webstore enable of the app launcher will create shortcuts on the desktop
and pin an icon to the taskbar.
The app launcher should never be disabled after it is enabled.
BUG=233434
TBR=benwells@chromium.org
Review URL: https://chromiumcodereview.appspot.com/13940006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps/app_launcher.cc')
-rw-r--r-- | apps/app_launcher.cc | 56 |
1 files changed, 8 insertions, 48 deletions
diff --git a/apps/app_launcher.cc b/apps/app_launcher.cc index b5c5fe9..77a75fc 100644 --- a/apps/app_launcher.cc +++ b/apps/app_launcher.cc @@ -5,7 +5,6 @@ #include "apps/app_launcher.h" #include "apps/pref_names.h" -#include "apps/switches.h" #include "base/command_line.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" @@ -35,40 +34,18 @@ AppLauncherState SynchronousAppLauncherChecks() { #elif !defined(OS_WIN) return APP_LAUNCHER_DISABLED; #else - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kShowAppListShortcut)) { - return APP_LAUNCHER_ENABLED; - } - #if defined(USE_ASH) if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) return APP_LAUNCHER_ENABLED; #endif - - if (!BrowserDistribution::GetDistribution()->AppHostIsSupported()) - return APP_LAUNCHER_DISABLED; - - return APP_LAUNCHER_UNKNOWN; -#endif -} - -#if defined(OS_WIN) -void UpdatePrefAndCallCallbackOnUI( - bool result, - const OnAppLauncherEnabledCompleted& completion_callback) { PrefService* prefs = g_browser_process->local_state(); - prefs->SetBoolean(prefs::kAppLauncherIsEnabled, result); - completion_callback.Run(result); -} - -void IsAppLauncherInstalledOnBlockingPool( - const OnAppLauncherEnabledCompleted& completion_callback) { - DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); - bool result = chrome_launcher_support::IsAppLauncherPresent(); - content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, - base::Bind(UpdatePrefAndCallCallbackOnUI, result, completion_callback)); -} + // In some tests, the prefs aren't initialised. + if (!prefs) + return APP_LAUNCHER_UNKNOWN; + return prefs->GetBoolean(prefs::kAppLauncherHasBeenEnabled) ? + APP_LAUNCHER_ENABLED : APP_LAUNCHER_DISABLED; #endif +} } // namespace @@ -83,31 +60,14 @@ void GetIsAppLauncherEnabled( AppLauncherState state = SynchronousAppLauncherChecks(); if (state != APP_LAUNCHER_UNKNOWN) { - bool is_enabled = state == APP_LAUNCHER_ENABLED; - PrefService* prefs = g_browser_process->local_state(); - prefs->SetBoolean(prefs::kAppLauncherIsEnabled, is_enabled); - completion_callback.Run(is_enabled); + completion_callback.Run(state == APP_LAUNCHER_ENABLED); return; } - -#if defined(OS_WIN) - content::BrowserThread::PostBlockingPoolTask( - FROM_HERE, - base::Bind(&IsAppLauncherInstalledOnBlockingPool, - completion_callback)); -#else - // SynchronousAppLauncherChecks() never returns APP_LAUNCHER_UNKNOWN on - // !defined(OS_WIN), so this path is never reached. NOTREACHED(); -#endif } bool WasAppLauncherEnabled() { - PrefService* prefs = g_browser_process->local_state(); - // In some tests, the prefs aren't initialised. - if (!prefs) - return SynchronousAppLauncherChecks() == APP_LAUNCHER_ENABLED; - return prefs->GetBoolean(prefs::kAppLauncherIsEnabled); + return SynchronousAppLauncherChecks() == APP_LAUNCHER_ENABLED; } } // namespace apps |