| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" | 5 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" |
| 6 | 6 |
| 7 #include "apps/app_launcher.h" | 7 #include "apps/app_launcher.h" |
| 8 #include "apps/switches.h" | |
| 9 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 11 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 12 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 13 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 14 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 15 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 15 #include "base/values.h" |
| 17 #include "chrome/browser/about_flags.h" | 16 #include "chrome/browser/about_flags.h" |
| 18 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 std::string username = profile->GetPrefs()->GetString( | 119 std::string username = profile->GetPrefs()->GetString( |
| 121 prefs::kGoogleServicesUsername); | 120 prefs::kGoogleServicesUsername); |
| 122 dictionary->SetString(kLoginKey, username); | 121 dictionary->SetString(kLoginKey, username); |
| 123 return dictionary; | 122 return dictionary; |
| 124 } | 123 } |
| 125 | 124 |
| 126 WebstoreInstaller::Delegate* test_webstore_installer_delegate = NULL; | 125 WebstoreInstaller::Delegate* test_webstore_installer_delegate = NULL; |
| 127 | 126 |
| 128 void EnableAppLauncher(base::Callback<void(bool)> callback) { | 127 void EnableAppLauncher(base::Callback<void(bool)> callback) { |
| 129 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
| 130 if (BrowserDistribution::GetDistribution()->AppHostIsSupported()) { | 129 LOG(INFO) << "Enabling App Launcher via internal enable"; |
| 131 LOG(INFO) << "Enabling App Launcher via installation"; | 130 AppListService::Get()->EnableAppList(); |
| 132 extensions::AppHostInstaller::SetInstallWithLauncher(true); | 131 callback.Run(true); |
| 133 extensions::AppHostInstaller::EnsureAppHostInstalled(callback); | |
| 134 } else { | |
| 135 LOG(INFO) << "Enabling App Launcher via flags"; | |
| 136 about_flags::SetExperimentEnabled(g_browser_process->local_state(), | |
| 137 apps::switches::kShowAppListShortcut, | |
| 138 true); | |
| 139 AppListService::Get()->EnableAppList(); | |
| 140 callback.Run(true); | |
| 141 } | |
| 142 #else | 132 #else |
| 143 callback.Run(true); | 133 callback.Run(true); |
| 144 #endif | 134 #endif |
| 145 } | 135 } |
| 146 | 136 |
| 147 } // namespace | 137 } // namespace |
| 148 | 138 |
| 149 // static | 139 // static |
| 150 void WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting( | 140 void WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting( |
| 151 WebstoreInstaller::Delegate* delegate) { | 141 WebstoreInstaller::Delegate* delegate) { |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 &GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted, this)); | 609 &GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted, this)); |
| 620 return true; | 610 return true; |
| 621 } | 611 } |
| 622 | 612 |
| 623 void GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted(bool is_enabled) { | 613 void GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted(bool is_enabled) { |
| 624 SetResult(Value::CreateBooleanValue(is_enabled)); | 614 SetResult(Value::CreateBooleanValue(is_enabled)); |
| 625 SendResponse(true); | 615 SendResponse(true); |
| 626 } | 616 } |
| 627 | 617 |
| 628 } // namespace extensions | 618 } // namespace extensions |
| OLD | NEW |