summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 09:29:22 +0000
committerkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 09:29:22 +0000
commit0319428dfde7e055d1d10cce194225eefbebbdb3 (patch)
tree2d6a379ba4ec3e2991c0d57a998d50c34c08f180
parentbe9915fbccfaab301759501d888579976427acfb (diff)
downloadchromium_src-0319428dfde7e055d1d10cce194225eefbebbdb3.zip
chromium_src-0319428dfde7e055d1d10cce194225eefbebbdb3.tar.gz
chromium_src-0319428dfde7e055d1d10cce194225eefbebbdb3.tar.bz2
Recreate App Launcher shortcut on first run.
BUG=258746 TEST=Enable the app launcher, uninstall Chrome (preserving user data), reinstall Chrome. You should still have an app launcher shortcut pinned to the taskbar. Review URL: https://chromiumcodereview.appspot.com/19088002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212303 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chrome_browser_main.cc2
-rw-r--r--chrome/browser/ui/app_list/app_list_service.h4
-rw-r--r--chrome/browser/ui/app_list/app_list_service_disabled.cc1
-rw-r--r--chrome/browser/ui/app_list/app_list_service_impl.cc2
-rw-r--r--chrome/browser/ui/app_list/app_list_service_impl.h1
-rw-r--r--chrome/browser/ui/views/app_list/app_list_controller_win.cc20
6 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index bcc7b11..b8e5204 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -1019,6 +1019,8 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
prefs::kBrowserSuppressDefaultBrowserPrompt,
master_prefs_->suppress_default_browser_prompt_for_version);
}
+
+ AppListService::Get()->HandleFirstRun();
}
if (do_first_run_tasks_ ||
diff --git a/chrome/browser/ui/app_list/app_list_service.h b/chrome/browser/ui/app_list/app_list_service.h
index ebb8f68..31cf3ce 100644
--- a/chrome/browser/ui/app_list/app_list_service.h
+++ b/chrome/browser/ui/app_list/app_list_service.h
@@ -34,6 +34,10 @@ class AppListService {
static void RegisterPrefs(PrefRegistrySimple* registry);
+ // Perform Chrome first run logic. This is executed before Chrome's threads
+ // have been created.
+ virtual void HandleFirstRun() = 0;
+
virtual base::FilePath GetProfilePath(
const base::FilePath& user_data_dir) = 0;
diff --git a/chrome/browser/ui/app_list/app_list_service_disabled.cc b/chrome/browser/ui/app_list/app_list_service_disabled.cc
index 5b46a16..b8fe9c7 100644
--- a/chrome/browser/ui/app_list/app_list_service_disabled.cc
+++ b/chrome/browser/ui/app_list/app_list_service_disabled.cc
@@ -21,6 +21,7 @@ class AppListServiceDisabled : public AppListService {
AppListServiceDisabled() {}
// AppListService overrides:
+ virtual void HandleFirstRun() OVERRIDE {}
virtual void Init(Profile* initial_profile) OVERRIDE {}
virtual base::FilePath GetProfilePath(
diff --git a/chrome/browser/ui/app_list/app_list_service_impl.cc b/chrome/browser/ui/app_list/app_list_service_impl.cc
index 0dcee73..2cee3b9 100644
--- a/chrome/browser/ui/app_list/app_list_service_impl.cc
+++ b/chrome/browser/ui/app_list/app_list_service_impl.cc
@@ -107,6 +107,8 @@ AppListServiceImpl::AppListServiceImpl()
AppListServiceImpl::~AppListServiceImpl() {}
+void AppListServiceImpl::HandleFirstRun() {}
+
void AppListServiceImpl::Init(Profile* initial_profile) {}
base::FilePath AppListServiceImpl::GetProfilePath(
diff --git a/chrome/browser/ui/app_list/app_list_service_impl.h b/chrome/browser/ui/app_list/app_list_service_impl.h
index 01cace7..e3ffcdd 100644
--- a/chrome/browser/ui/app_list/app_list_service_impl.h
+++ b/chrome/browser/ui/app_list/app_list_service_impl.h
@@ -53,6 +53,7 @@ class AppListServiceImpl : public AppListService,
virtual void OnSigninStatusChanged();
// AppListService overrides:
+ virtual void HandleFirstRun() OVERRIDE;
virtual void Init(Profile* initial_profile) OVERRIDE;
virtual base::FilePath GetProfilePath(
const base::FilePath& user_data_dir) OVERRIDE;
diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc
index 20cc64f..8298000 100644
--- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc
+++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc
@@ -306,6 +306,7 @@ class AppListController : public AppListServiceImpl {
app_list::AppListView* GetView() { return current_view_; }
// AppListService overrides:
+ virtual void HandleFirstRun() OVERRIDE;
virtual void Init(Profile* initial_profile) OVERRIDE;
virtual void ShowAppList(Profile* requested_profile) OVERRIDE;
virtual void DismissAppList() OVERRIDE;
@@ -388,6 +389,8 @@ class AppListController : public AppListServiceImpl {
// the right mouse button down, but not if this happens twice in a row.
bool preserving_focus_for_taskbar_menu_;
+ bool enable_app_list_on_next_init_;
+
base::WeakPtrFactory<AppListController> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(AppListController);
@@ -480,6 +483,7 @@ AppListController::AppListController()
can_close_app_list_(true),
regain_first_lost_focus_(false),
preserving_focus_for_taskbar_menu_(false),
+ enable_app_list_on_next_init_(false),
weak_factory_(this) {}
AppListController::~AppListController() {
@@ -851,12 +855,28 @@ void AppListController::OnLoadProfileForWarmup(Profile* initial_profile) {
current_view_->Prerender();
}
+void AppListController::HandleFirstRun() {
+ PrefService* local_state = g_browser_process->local_state();
+ // If the app list is already enabled during first run, then the user had
+ // opted in to the app launcher before uninstalling, so we re-enable to
+ // restore shortcuts to the app list.
+ // Note we can't directly create the shortcuts here because the IO thread
+ // hasn't been created yet.
+ enable_app_list_on_next_init_ = local_state->GetBoolean(
+ apps::prefs::kAppLauncherHasBeenEnabled);
+}
+
void AppListController::Init(Profile* initial_profile) {
// In non-Ash metro mode, we can not show the app list for this process, so do
// not bother performing Init tasks.
if (win8::IsSingleWindowMetroMode())
return;
+ if (enable_app_list_on_next_init_) {
+ enable_app_list_on_next_init_ = false;
+ EnableAppList(initial_profile);
+ }
+
PrefService* prefs = g_browser_process->local_state();
if (prefs->HasPrefPath(prefs::kRestartWithAppList) &&
prefs->GetBoolean(prefs::kRestartWithAppList)) {