OLD | NEW |
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/login/app_launch_controller.h" | 5 #include "chrome/browser/chromeos/login/app_launch_controller.h" |
6 | 6 |
7 #include "apps/app_window.h" | |
8 #include "apps/app_window_registry.h" | |
9 #include "base/bind.h" | 7 #include "base/bind.h" |
10 #include "base/callback.h" | 8 #include "base/callback.h" |
11 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
12 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
13 #include "base/logging.h" | 11 #include "base/logging.h" |
14 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
16 #include "base/time/time.h" | 14 #include "base/time/time.h" |
17 #include "base/values.h" | 15 #include "base/values.h" |
18 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
20 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h" | 18 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h" |
21 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 19 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
22 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" | 20 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" |
23 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" | 21 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" |
24 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 22 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
25 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 23 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
26 #include "chrome/browser/chromeos/login/ui/oobe_display.h" | 24 #include "chrome/browser/chromeos/login/ui/oobe_display.h" |
27 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 25 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
28 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
29 #include "chrome/browser/chromeos/settings/cros_settings.h" | 27 #include "chrome/browser/chromeos/settings/cros_settings.h" |
30 #include "chrome/browser/lifetime/application_lifetime.h" | 28 #include "chrome/browser/lifetime/application_lifetime.h" |
31 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle
r.h" | 30 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle
r.h" |
33 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 31 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
34 #include "components/user_manager/user_manager.h" | 32 #include "components/user_manager/user_manager.h" |
35 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 34 #include "extensions/browser/app_window/app_window.h" |
| 35 #include "extensions/browser/app_window/app_window_registry.h" |
36 #include "net/base/network_change_notifier.h" | 36 #include "net/base/network_change_notifier.h" |
37 | 37 |
38 namespace chromeos { | 38 namespace chromeos { |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 // Application install splash screen minimum show time in milliseconds. | 42 // Application install splash screen minimum show time in milliseconds. |
43 const int kAppInstallSplashScreenMinTimeMS = 3000; | 43 const int kAppInstallSplashScreenMinTimeMS = 3000; |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 // static | 47 // static |
48 bool AppLaunchController::skip_splash_wait_ = false; | 48 bool AppLaunchController::skip_splash_wait_ = false; |
49 int AppLaunchController::network_wait_time_ = 10; | 49 int AppLaunchController::network_wait_time_ = 10; |
50 base::Closure* AppLaunchController::network_timeout_callback_ = NULL; | 50 base::Closure* AppLaunchController::network_timeout_callback_ = NULL; |
51 AppLaunchController::ReturnBoolCallback* | 51 AppLaunchController::ReturnBoolCallback* |
52 AppLaunchController::can_configure_network_callback_ = NULL; | 52 AppLaunchController::can_configure_network_callback_ = NULL; |
53 AppLaunchController::ReturnBoolCallback* | 53 AppLaunchController::ReturnBoolCallback* |
54 AppLaunchController::need_owner_auth_to_configure_network_callback_ = NULL; | 54 AppLaunchController::need_owner_auth_to_configure_network_callback_ = NULL; |
55 | 55 |
56 //////////////////////////////////////////////////////////////////////////////// | 56 //////////////////////////////////////////////////////////////////////////////// |
57 // AppLaunchController::AppWindowWatcher | 57 // AppLaunchController::AppWindowWatcher |
58 | 58 |
59 class AppLaunchController::AppWindowWatcher | 59 class AppLaunchController::AppWindowWatcher |
60 : public apps::AppWindowRegistry::Observer { | 60 : public extensions::AppWindowRegistry::Observer { |
61 public: | 61 public: |
62 explicit AppWindowWatcher(AppLaunchController* controller, | 62 explicit AppWindowWatcher(AppLaunchController* controller, |
63 const std::string& app_id) | 63 const std::string& app_id) |
64 : controller_(controller), | 64 : controller_(controller), |
65 app_id_(app_id), | 65 app_id_(app_id), |
66 window_registry_(apps::AppWindowRegistry::Get(controller->profile_)), | 66 window_registry_( |
| 67 extensions::AppWindowRegistry::Get(controller->profile_)), |
67 weak_factory_(this) { | 68 weak_factory_(this) { |
68 if (!window_registry_->GetAppWindowsForApp(app_id).empty()) { | 69 if (!window_registry_->GetAppWindowsForApp(app_id).empty()) { |
69 base::MessageLoop::current()->PostTask( | 70 base::MessageLoop::current()->PostTask( |
70 FROM_HERE, | 71 FROM_HERE, |
71 base::Bind(&AppWindowWatcher::NotifyAppWindowCreated, | 72 base::Bind(&AppWindowWatcher::NotifyAppWindowCreated, |
72 weak_factory_.GetWeakPtr())); | 73 weak_factory_.GetWeakPtr())); |
73 return; | 74 return; |
74 } else { | 75 } else { |
75 window_registry_->AddObserver(this); | 76 window_registry_->AddObserver(this); |
76 } | 77 } |
77 } | 78 } |
78 virtual ~AppWindowWatcher() { | 79 virtual ~AppWindowWatcher() { |
79 window_registry_->RemoveObserver(this); | 80 window_registry_->RemoveObserver(this); |
80 } | 81 } |
81 | 82 |
82 private: | 83 private: |
83 // apps::AppWindowRegistry::Observer overrides: | 84 // extensions::AppWindowRegistry::Observer overrides: |
84 virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE { | 85 virtual void OnAppWindowAdded(extensions::AppWindow* app_window) OVERRIDE { |
85 if (app_window->extension_id() == app_id_) { | 86 if (app_window->extension_id() == app_id_) { |
86 window_registry_->RemoveObserver(this); | 87 window_registry_->RemoveObserver(this); |
87 NotifyAppWindowCreated(); | 88 NotifyAppWindowCreated(); |
88 } | 89 } |
89 } | 90 } |
90 | 91 |
91 void NotifyAppWindowCreated() { | 92 void NotifyAppWindowCreated() { |
92 controller_->OnAppWindowCreated(); | 93 controller_->OnAppWindowCreated(); |
93 } | 94 } |
94 | 95 |
95 AppLaunchController* controller_; | 96 AppLaunchController* controller_; |
96 std::string app_id_; | 97 std::string app_id_; |
97 apps::AppWindowRegistry* window_registry_; | 98 extensions::AppWindowRegistry* window_registry_; |
98 base::WeakPtrFactory<AppWindowWatcher> weak_factory_; | 99 base::WeakPtrFactory<AppWindowWatcher> weak_factory_; |
99 | 100 |
100 DISALLOW_COPY_AND_ASSIGN(AppWindowWatcher); | 101 DISALLOW_COPY_AND_ASSIGN(AppWindowWatcher); |
101 }; | 102 }; |
102 | 103 |
103 //////////////////////////////////////////////////////////////////////////////// | 104 //////////////////////////////////////////////////////////////////////////////// |
104 // AppLaunchController | 105 // AppLaunchController |
105 | 106 |
106 AppLaunchController::AppLaunchController(const std::string& app_id, | 107 AppLaunchController::AppLaunchController(const std::string& app_id, |
107 bool diagnostic_mode, | 108 bool diagnostic_mode, |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 KioskAppLaunchError::Save(error); | 420 KioskAppLaunchError::Save(error); |
420 chrome::AttemptUserExit(); | 421 chrome::AttemptUserExit(); |
421 CleanUp(); | 422 CleanUp(); |
422 } | 423 } |
423 | 424 |
424 bool AppLaunchController::IsShowingNetworkConfigScreen() { | 425 bool AppLaunchController::IsShowingNetworkConfigScreen() { |
425 return network_config_requested_; | 426 return network_config_requested_; |
426 } | 427 } |
427 | 428 |
428 } // namespace chromeos | 429 } // namespace chromeos |
OLD | NEW |