Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: chrome/browser/chromeos/app_mode/startup_app_launcher.cc

Issue 13581008: cros: Explicitly manage app session lifetime. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: solution 2 Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/app_mode/startup_app_launcher.cc
diff --git a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
index 6f21c3ae4809d66203af7f34c9f494604ad781f7..93af87da135c3b5ccef5902a1662772b124a4bfe 100644
--- a/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
+++ b/chrome/browser/chromeos/app_mode/startup_app_launcher.cc
@@ -9,19 +9,16 @@
#include "base/files/file_path.h"
#include "base/json/json_file_value_serializer.h"
#include "base/path_service.h"
-#include "base/prefs/pref_service.h"
#include "base/time.h"
#include "base/values.h"
-#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/app_mode/app_session_lifetime.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
-#include "chrome/browser/chromeos/app_mode/kiosk_app_update_service.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/ui/app_launch_view.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/webstore_startup_installer.h"
#include "chrome/browser/lifetime/application_lifetime.h"
-#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/signin/token_service.h"
#include "chrome/browser/signin/token_service_factory.h"
#include "chrome/browser/ui/extensions/application_launch.h"
@@ -29,7 +26,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h"
-#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "google_apis/gaia/gaia_auth_consumer.h"
#include "google_apis/gaia/gaia_constants.h"
@@ -42,7 +38,6 @@ namespace chromeos {
namespace {
-
const char kOAuthRefreshToken[] = "refresh_token";
const char kOAuthClientId[] = "client_id";
const char kOAuthClientSecret[] = "client_secret";
@@ -53,13 +48,6 @@ const base::FilePath::CharType kOAuthFileName[] =
// Application install splash screen minimum show time in milliseconds.
const int kAppInstallSplashScreenMinTimeMS = 3000;
-// Initial delay that gives an app 30 seconds during which the main app window
-// must be created. If app fails to create the main window in this timeframe,
-// chrome will exit.
-// TODO(xiyuan): Find a nicer way to trace process lifetime management at
-// startup. This just fixes a race that happens on faster machines.
-const int kInitialEndKeepAliveDelayinSec = 30;
-
bool IsAppInstalled(Profile* profile, const std::string& app_id) {
return extensions::ExtensionSystem::Get(profile)->extension_service()->
GetInstalledExtension(app_id);
@@ -217,16 +205,6 @@ void StartupAppLauncher::Observe(
void StartupAppLauncher::Cleanup() {
chromeos::CloseAppLaunchSplashScreen();
- // Ends OpenAsh() keep alive since the session should either be bound with
- // the just launched app on success or should be ended on failure.
- // Invoking it via a PostNonNestableTask because Cleanup() could be called
- // before main message loop starts.
- BrowserThread::PostNonNestableDelayedTask(
- BrowserThread::UI,
- FROM_HERE,
- base::Bind(&chrome::EndKeepAlive),
- base::TimeDelta::FromSeconds(kInitialEndKeepAliveDelayinSec));
-
delete this;
}
@@ -270,24 +248,12 @@ void StartupAppLauncher::Launch() {
return;
}
- // Set the app_id for the current instance of KioskAppUpdateService.
- KioskAppUpdateService* update_service =
- KioskAppUpdateServiceFactory::GetForProfile(profile_);
- DCHECK(update_service);
- if (update_service)
- update_service->set_app_id(app_id_);
-
- // If the device is not enterprise managed, set prefs to reboot after update.
- if (!g_browser_process->browser_policy_connector()->IsEnterpriseManaged()) {
- PrefService* local_state = g_browser_process->local_state();
- local_state->SetBoolean(prefs::kRebootAfterUpdate, true);
- }
-
// Always open the app in a window.
chrome::OpenApplication(chrome::AppLaunchParams(profile_,
extension,
extension_misc::LAUNCH_WINDOW,
NEW_WINDOW));
+ InitAppSession(profile_, app_id_);
OnLaunchSuccess();
}
« no previous file with comments | « chrome/browser/chromeos/app_mode/app_session_lifetime.cc ('k') | chrome/browser/lifetime/application_lifetime_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698