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

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

Issue 271263002: New test cases for kiosk app crx file cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improvement based on comments. Created 6 years, 7 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/kiosk_app_manager.h" 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 void KioskAppManager::AddObserver(KioskAppManagerObserver* observer) { 359 void KioskAppManager::AddObserver(KioskAppManagerObserver* observer) {
360 observers_.AddObserver(observer); 360 observers_.AddObserver(observer);
361 } 361 }
362 362
363 void KioskAppManager::RemoveObserver(KioskAppManagerObserver* observer) { 363 void KioskAppManager::RemoveObserver(KioskAppManagerObserver* observer) {
364 observers_.RemoveObserver(observer); 364 observers_.RemoveObserver(observer);
365 } 365 }
366 366
367 KioskAppManager::KioskAppManager() : ownership_established_(false) { 367 KioskAppManager::KioskAppManager() : ownership_established_(false) {
368 base::FilePath cache_dir; 368 base::FilePath cache_dir;
369 GetKioskAppCrxCacheDir(&cache_dir); 369 GetCrxCacheDir(&cache_dir);
370 external_cache_.reset( 370 external_cache_.reset(
371 new ExternalCache(cache_dir, 371 new ExternalCache(cache_dir,
372 g_browser_process->system_request_context(), 372 g_browser_process->system_request_context(),
373 GetBackgroundTaskRunner(), 373 GetBackgroundTaskRunner(),
374 this, 374 this,
375 true /* always_check_updates */, 375 true /* always_check_updates */,
376 false /* wait_for_cache_initialization */)); 376 false /* wait_for_cache_initialization */));
377 377
378 UpdateAppData(); 378 UpdateAppData();
379 local_accounts_subscription_ = 379 local_accounts_subscription_ =
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 } 523 }
524 524
525 void KioskAppManager::SetAutoLoginState(AutoLoginState state) { 525 void KioskAppManager::SetAutoLoginState(AutoLoginState state) {
526 PrefService* prefs = g_browser_process->local_state(); 526 PrefService* prefs = g_browser_process->local_state();
527 DictionaryPrefUpdate dict_update(prefs, 527 DictionaryPrefUpdate dict_update(prefs,
528 KioskAppManager::kKioskDictionaryName); 528 KioskAppManager::kKioskDictionaryName);
529 dict_update->SetInteger(kKeyAutoLoginState, state); 529 dict_update->SetInteger(kKeyAutoLoginState, state);
530 prefs->CommitPendingWrite(); 530 prefs->CommitPendingWrite();
531 } 531 }
532 532
533 void KioskAppManager::GetKioskAppCrxCacheDir(base::FilePath* cache_dir) { 533 void KioskAppManager::GetCrxCacheDir(base::FilePath* cache_dir) {
534 base::FilePath user_data_dir; 534 base::FilePath user_data_dir;
535 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); 535 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));
536 *cache_dir = user_data_dir.AppendASCII(kCrxCacheDir); 536 *cache_dir = user_data_dir.AppendASCII(kCrxCacheDir);
537 } 537 }
538 538
539 bool KioskAppManager::GetCachedCrx(const std::string& app_id,
540 base::FilePath* file_path,
541 std::string* version) {
542 return external_cache_->GetExtension(app_id, file_path, version);
543 }
544
539 } // namespace chromeos 545 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698