| 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/app_mode/kiosk_app_manager.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 explicit AppDataLoadWaiter(KioskAppManager* manager) | 69 explicit AppDataLoadWaiter(KioskAppManager* manager) |
| 70 : manager_(manager), | 70 : manager_(manager), |
| 71 loaded_(false) { | 71 loaded_(false) { |
| 72 manager_->AddObserver(this); | 72 manager_->AddObserver(this); |
| 73 } | 73 } |
| 74 virtual ~AppDataLoadWaiter() { | 74 virtual ~AppDataLoadWaiter() { |
| 75 manager_->RemoveObserver(this); | 75 manager_->RemoveObserver(this); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void Wait() { | 78 void Wait() { |
| 79 MessageLoop::current()->Run(); | 79 base::MessageLoop::current()->Run(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool loaded() const { return loaded_; } | 82 bool loaded() const { return loaded_; } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 // KioskAppManagerObserver overrides: | 85 // KioskAppManagerObserver overrides: |
| 86 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE { | 86 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE { |
| 87 loaded_ = true; | 87 loaded_ = true; |
| 88 MessageLoop::current()->Quit(); | 88 base::MessageLoop::current()->Quit(); |
| 89 } | 89 } |
| 90 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE { | 90 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE { |
| 91 loaded_ = false; | 91 loaded_ = false; |
| 92 MessageLoop::current()->Quit(); | 92 base::MessageLoop::current()->Quit(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 KioskAppManager* manager_; | 95 KioskAppManager* manager_; |
| 96 bool loaded_; | 96 bool loaded_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(AppDataLoadWaiter); | 98 DISALLOW_COPY_AND_ASSIGN(AppDataLoadWaiter); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace | 101 } // namespace |
| 102 | 102 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 base::FilePath expected_icon_path; | 269 base::FilePath expected_icon_path; |
| 270 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &expected_icon_path)); | 270 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &expected_icon_path)); |
| 271 expected_icon_path = expected_icon_path. | 271 expected_icon_path = expected_icon_path. |
| 272 AppendASCII(KioskAppManager::kIconCacheDir). | 272 AppendASCII(KioskAppManager::kIconCacheDir). |
| 273 AppendASCII(apps[0].app_id).AddExtension(".png"); | 273 AppendASCII(apps[0].app_id).AddExtension(".png"); |
| 274 EXPECT_EQ(expected_icon_path.value(), icon_path_string); | 274 EXPECT_EQ(expected_icon_path.value(), icon_path_string); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace chromeos | 277 } // namespace chromeos |
| OLD | NEW |