OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ash/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
6 #include "ash/desktop_background/desktop_background_controller_observer.h" | 6 #include "ash/desktop_background/desktop_background_controller_observer.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 bool CheckJs() { | 236 bool CheckJs() { |
237 bool result; | 237 bool result; |
238 CHECK(content::ExecuteScriptAndExtractBool( | 238 CHECK(content::ExecuteScriptAndExtractBool( |
239 web_contents_, | 239 web_contents_, |
240 "window.domAutomationController.send(!!(" + js_ + "));", | 240 "window.domAutomationController.send(!!(" + js_ + "));", |
241 &result)); | 241 &result)); |
242 return result; | 242 return result; |
243 } | 243 } |
244 | 244 |
245 void OnTimer() { | 245 void OnTimer() { |
246 DCHECK(runner_); | 246 DCHECK(runner_.get()); |
247 if (CheckJs()) | 247 if (CheckJs()) |
248 runner_->Quit(); | 248 runner_->Quit(); |
249 } | 249 } |
250 | 250 |
251 content::WebContents* web_contents_; | 251 content::WebContents* web_contents_; |
252 const std::string js_; | 252 const std::string js_; |
253 scoped_refptr<content::MessageLoopRunner> runner_; | 253 scoped_refptr<content::MessageLoopRunner> runner_; |
254 | 254 |
255 DISALLOW_COPY_AND_ASSIGN(JsConditionWaiter); | 255 DISALLOW_COPY_AND_ASSIGN(JsConditionWaiter); |
256 }; | 256 }; |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 // KioskAppManagerObserver overrides: | 1085 // KioskAppManagerObserver overrides: |
1086 virtual void OnKioskAppCacheUpdated(const std::string& app_id) OVERRIDE { | 1086 virtual void OnKioskAppCacheUpdated(const std::string& app_id) OVERRIDE { |
1087 if (app_id_ != app_id) | 1087 if (app_id_ != app_id) |
1088 return; | 1088 return; |
1089 app_update_notified_ = true; | 1089 app_update_notified_ = true; |
1090 } | 1090 } |
1091 | 1091 |
1092 virtual void OnKioskAppExternalUpdateComplete(bool success) OVERRIDE { | 1092 virtual void OnKioskAppExternalUpdateComplete(bool success) OVERRIDE { |
1093 quit_ = true; | 1093 quit_ = true; |
1094 update_success_ = success; | 1094 update_success_ = success; |
1095 if (runner_) | 1095 if (runner_.get()) |
1096 runner_->Quit(); | 1096 runner_->Quit(); |
1097 } | 1097 } |
1098 | 1098 |
1099 scoped_refptr<content::MessageLoopRunner> runner_; | 1099 scoped_refptr<content::MessageLoopRunner> runner_; |
1100 KioskAppManager* manager_; | 1100 KioskAppManager* manager_; |
1101 bool wait_for_update_success_; | 1101 bool wait_for_update_success_; |
1102 const std::string app_id_; | 1102 const std::string app_id_; |
1103 bool quit_; | 1103 bool quit_; |
1104 bool update_success_; | 1104 bool update_success_; |
1105 bool app_update_notified_; | 1105 bool app_update_notified_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 virtual void OnKioskExtensionLoadedInCache( | 1137 virtual void OnKioskExtensionLoadedInCache( |
1138 const std::string& app_id) OVERRIDE { | 1138 const std::string& app_id) OVERRIDE { |
1139 std::string cached_version; | 1139 std::string cached_version; |
1140 base::FilePath file_path; | 1140 base::FilePath file_path; |
1141 if (!manager_->GetCachedCrx(app_id_, &file_path, &cached_version)) | 1141 if (!manager_->GetCachedCrx(app_id_, &file_path, &cached_version)) |
1142 return; | 1142 return; |
1143 if (version_ != cached_version) | 1143 if (version_ != cached_version) |
1144 return; | 1144 return; |
1145 loaded_ = true; | 1145 loaded_ = true; |
1146 quit_ = true; | 1146 quit_ = true; |
1147 if (runner_) | 1147 if (runner_.get()) |
1148 runner_->Quit(); | 1148 runner_->Quit(); |
1149 } | 1149 } |
1150 | 1150 |
1151 virtual void OnKioskExtensionDownloadFailed( | 1151 virtual void OnKioskExtensionDownloadFailed( |
1152 const std::string& app_id) OVERRIDE { | 1152 const std::string& app_id) OVERRIDE { |
1153 loaded_ = false; | 1153 loaded_ = false; |
1154 quit_ = true; | 1154 quit_ = true; |
1155 if (runner_) | 1155 if (runner_.get()) |
1156 runner_->Quit(); | 1156 runner_->Quit(); |
1157 } | 1157 } |
1158 | 1158 |
1159 scoped_refptr<content::MessageLoopRunner> runner_; | 1159 scoped_refptr<content::MessageLoopRunner> runner_; |
1160 KioskAppManager* manager_; | 1160 KioskAppManager* manager_; |
1161 bool loaded_; | 1161 bool loaded_; |
1162 bool quit_; | 1162 bool quit_; |
1163 std::string app_id_; | 1163 std::string app_id_; |
1164 std::string version_; | 1164 std::string version_; |
1165 | 1165 |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 content::WindowedNotificationObserver( | 1696 content::WindowedNotificationObserver( |
1697 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1697 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
1698 content::NotificationService::AllSources()).Wait(); | 1698 content::NotificationService::AllSources()).Wait(); |
1699 | 1699 |
1700 // Wait for the wallpaper to load. | 1700 // Wait for the wallpaper to load. |
1701 WaitForWallpaper(); | 1701 WaitForWallpaper(); |
1702 EXPECT_TRUE(wallpaper_loaded()); | 1702 EXPECT_TRUE(wallpaper_loaded()); |
1703 } | 1703 } |
1704 | 1704 |
1705 } // namespace chromeos | 1705 } // namespace chromeos |
OLD | NEW |