| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 explicit AppDataLoadWaiter(KioskAppManager* manager) | 65 explicit AppDataLoadWaiter(KioskAppManager* manager) |
| 66 : manager_(manager), | 66 : manager_(manager), |
| 67 loaded_(false) { | 67 loaded_(false) { |
| 68 manager_->AddObserver(this); | 68 manager_->AddObserver(this); |
| 69 } | 69 } |
| 70 virtual ~AppDataLoadWaiter() { | 70 virtual ~AppDataLoadWaiter() { |
| 71 manager_->RemoveObserver(this); | 71 manager_->RemoveObserver(this); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void Wait() { | 74 void Wait() { |
| 75 MessageLoop::current()->Run(); | 75 base::MessageLoop::current()->Run(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool loaded() const { return loaded_; } | 78 bool loaded() const { return loaded_; } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 // KioskAppManagerObserver overrides: | 81 // KioskAppManagerObserver overrides: |
| 82 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE { | 82 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE { |
| 83 loaded_ = true; | 83 loaded_ = true; |
| 84 MessageLoop::current()->Quit(); | 84 base::MessageLoop::current()->Quit(); |
| 85 } | 85 } |
| 86 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE { | 86 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE { |
| 87 loaded_ = false; | 87 loaded_ = false; |
| 88 MessageLoop::current()->Quit(); | 88 base::MessageLoop::current()->Quit(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 KioskAppManager* manager_; | 91 KioskAppManager* manager_; |
| 92 bool loaded_; | 92 bool loaded_; |
| 93 | 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(AppDataLoadWaiter); | 94 DISALLOW_COPY_AND_ASSIGN(AppDataLoadWaiter); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace | 97 } // namespace |
| 98 | 98 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 base::FilePath expected_icon_path; | 261 base::FilePath expected_icon_path; |
| 262 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &expected_icon_path)); | 262 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &expected_icon_path)); |
| 263 expected_icon_path = expected_icon_path. | 263 expected_icon_path = expected_icon_path. |
| 264 AppendASCII(KioskAppManager::kIconCacheDir). | 264 AppendASCII(KioskAppManager::kIconCacheDir). |
| 265 AppendASCII(apps[0].id).AddExtension(".png"); | 265 AppendASCII(apps[0].id).AddExtension(".png"); |
| 266 EXPECT_EQ(expected_icon_path.value(), icon_path_string); | 266 EXPECT_EQ(expected_icon_path.value(), icon_path_string); |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace chromeos | 269 } // namespace chromeos |
| OLD | NEW |