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

Side by Side Diff: chrome/browser/chromeos/app_mode/app_session_lifetime.cc

Issue 166573005: Rename apps::ShellWindow to apps::AppWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, nits (rename) Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/app_mode/app_session_lifetime.h" 5 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h"
6 6
7 #include "apps/shell_window.h" 7 #include "apps/app_window.h"
8 #include "apps/shell_window_registry.h" 8 #include "apps/app_window_registry.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/app_mode/kiosk_app_update_service.h" 15 #include "chrome/browser/chromeos/app_mode/kiosk_app_update_service.h"
16 #include "chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification .h" 16 #include "chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification .h"
17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
18 #include "chrome/browser/lifetime/application_lifetime.h" 18 #include "chrome/browser/lifetime/application_lifetime.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_list.h" 21 #include "chrome/browser/ui/browser_list.h"
22 #include "chrome/browser/ui/browser_list_observer.h" 22 #include "chrome/browser/ui/browser_list_observer.h"
23 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" 24 #include "chrome/browser/ui/tabs/tab_strip_model.h"
25 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
26 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
27 27
28 using apps::ShellWindowRegistry; 28 using apps::AppWindowRegistry;
29 29
30 namespace chromeos { 30 namespace chromeos {
31 31
32 namespace { 32 namespace {
33 33
34 // AppWindowHandler watches for app window and exits the session when the 34 // AppWindowHandler watches for app window and exits the session when the
35 // last app window is closed. 35 // last app window is closed.
36 class AppWindowHandler : public ShellWindowRegistry::Observer { 36 class AppWindowHandler : public AppWindowRegistry::Observer {
37 public: 37 public:
38 AppWindowHandler() : window_registry_(NULL) {} 38 AppWindowHandler() : window_registry_(NULL) {}
39 virtual ~AppWindowHandler() {} 39 virtual ~AppWindowHandler() {}
40 40
41 void Init(Profile* profile) { 41 void Init(Profile* profile) {
42 DCHECK(!window_registry_); 42 DCHECK(!window_registry_);
43 window_registry_ = ShellWindowRegistry::Get(profile); 43 window_registry_ = AppWindowRegistry::Get(profile);
44 if (window_registry_) 44 if (window_registry_)
45 window_registry_->AddObserver(this); 45 window_registry_->AddObserver(this);
46 } 46 }
47 47
48 private: 48 private:
49 // apps::ShellWindowRegistry::Observer overrides: 49 // apps::AppWindowRegistry::Observer overrides:
50 virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE {} 50 virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE {}
51 virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window) 51 virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE {}
52 OVERRIDE {} 52 virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE {
53 virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE { 53 if (window_registry_->app_windows().empty()) {
54 if (window_registry_->shell_windows().empty()) {
55 chrome::AttemptUserExit(); 54 chrome::AttemptUserExit();
56 window_registry_->RemoveObserver(this); 55 window_registry_->RemoveObserver(this);
57 } 56 }
58 } 57 }
59 58
60 apps::ShellWindowRegistry* window_registry_; 59 apps::AppWindowRegistry* window_registry_;
61 60
62 DISALLOW_COPY_AND_ASSIGN(AppWindowHandler); 61 DISALLOW_COPY_AND_ASSIGN(AppWindowHandler);
63 }; 62 };
64 63
65 base::LazyInstance<AppWindowHandler> app_window_handler 64 base::LazyInstance<AppWindowHandler> app_window_handler
66 = LAZY_INSTANCE_INITIALIZER; 65 = LAZY_INSTANCE_INITIALIZER;
67 66
68 // BrowserWindowHandler monitors Browser object being created during 67 // BrowserWindowHandler monitors Browser object being created during
69 // a kiosk session, log info such as URL so that the code path could be 68 // a kiosk session, log info such as URL so that the code path could be
70 // fixed and closes the just opened browser window. 69 // fixed and closes the just opened browser window.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 policy::BrowserPolicyConnectorChromeOS* connector = 126 policy::BrowserPolicyConnectorChromeOS* connector =
128 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 127 g_browser_process->platform_part()->browser_policy_connector_chromeos();
129 if (!connector->IsEnterpriseManaged()) { 128 if (!connector->IsEnterpriseManaged()) {
130 PrefService* local_state = g_browser_process->local_state(); 129 PrefService* local_state = g_browser_process->local_state();
131 local_state->SetBoolean(prefs::kRebootAfterUpdate, true); 130 local_state->SetBoolean(prefs::kRebootAfterUpdate, true);
132 KioskModeIdleAppNameNotification::Initialize(); 131 KioskModeIdleAppNameNotification::Initialize();
133 } 132 }
134 } 133 }
135 134
136 } // namespace chromeos 135 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698