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

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

Issue 873873002: kiosk: Close on the last window of kiosk app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/app_mode/app_session_lifetime.cc
diff --git a/chrome/browser/chromeos/app_mode/app_session_lifetime.cc b/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
index fe40288df2535d8f0a1a2dd87fb364303f7a0de0..741a1c13e6d802a15c37749b19517fccffcb614c 100644
--- a/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
+++ b/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
@@ -38,23 +38,24 @@ namespace chromeos {
namespace {
// AppWindowHandler watches for app window and exits the session when the
-// last app window is closed.
+// last window of a given app is closed.
class AppWindowHandler : public AppWindowRegistry::Observer {
public:
AppWindowHandler() : window_registry_(NULL) {}
~AppWindowHandler() override {}
- void Init(Profile* profile) {
+ void Init(Profile* profile, const std::string& app_id) {
DCHECK(!window_registry_);
window_registry_ = AppWindowRegistry::Get(profile);
if (window_registry_)
window_registry_->AddObserver(this);
+ app_id_ = app_id;
}
private:
// extensions::AppWindowRegistry::Observer overrides:
void OnAppWindowRemoved(AppWindow* app_window) override {
- if (window_registry_->app_windows().empty()) {
+ if (window_registry_->GetAppWindowsForApp(app_id_).empty()) {
if (DemoAppLauncher::IsDemoAppSession(
user_manager::UserManager::Get()->GetActiveUser()->email())) {
// If we were in demo mode, we disabled all our network technologies,
@@ -72,6 +73,7 @@ class AppWindowHandler : public AppWindowRegistry::Observer {
}
AppWindowRegistry* window_registry_;
+ std::string app_id_;
bartfab (slow) 2015/01/26 15:59:46 Nit: const.
xiyuan 2015/01/26 17:21:32 Cannot use const here because we use it as a AppWi
DISALLOW_COPY_AND_ASSIGN(AppWindowHandler);
};
@@ -121,7 +123,7 @@ base::LazyInstance<BrowserWindowHandler> browser_window_handler
void InitAppSession(Profile* profile, const std::string& app_id) {
// Binds the session lifetime with app window counts.
CHECK(app_window_handler == NULL);
- app_window_handler.Get().Init(profile);
+ app_window_handler.Get().Init(profile, app_id);
CHECK(browser_window_handler == NULL);
browser_window_handler.Get();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698