OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/app_pack_updater.h" | 5 #include "chrome/browser/chromeos/policy/app_pack_updater.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 virtual ~AppPackExternalLoader() {} | 55 virtual ~AppPackExternalLoader() {} |
56 | 56 |
57 private: | 57 private: |
58 base::DictionaryValue app_pack_prefs_; | 58 base::DictionaryValue app_pack_prefs_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(AppPackExternalLoader); | 60 DISALLOW_COPY_AND_ASSIGN(AppPackExternalLoader); |
61 }; | 61 }; |
62 | 62 |
63 AppPackUpdater::AppPackUpdater(net::URLRequestContextGetter* request_context, | 63 AppPackUpdater::AppPackUpdater(net::URLRequestContextGetter* request_context, |
64 EnterpriseInstallAttributes* install_attributes) | 64 EnterpriseInstallAttributes* install_attributes) |
65 : weak_ptr_factory_(this), | 65 : created_extension_loader_(false), |
66 created_extension_loader_(false), | |
67 install_attributes_(install_attributes), | 66 install_attributes_(install_attributes), |
68 external_cache_(base::FilePath(kAppPackCacheDir), | 67 external_cache_(base::FilePath(kAppPackCacheDir), |
69 request_context, | 68 request_context, |
70 content::BrowserThread::GetBlockingPool()-> | 69 content::BrowserThread::GetBlockingPool()-> |
71 GetSequencedTaskRunnerWithShutdownBehavior( | 70 GetSequencedTaskRunnerWithShutdownBehavior( |
72 content::BrowserThread::GetBlockingPool()-> | 71 content::BrowserThread::GetBlockingPool()-> |
73 GetSequenceToken(), | 72 GetSequenceToken(), |
74 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN), | 73 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN), |
75 this, | 74 this, |
76 false, | 75 false, |
77 false) { | 76 false), |
| 77 weak_ptr_factory_(this) { |
78 app_pack_subscription_ = chromeos::CrosSettings::Get()->AddSettingsObserver( | 78 app_pack_subscription_ = chromeos::CrosSettings::Get()->AddSettingsObserver( |
79 chromeos::kAppPack, | 79 chromeos::kAppPack, |
80 base::Bind(&AppPackUpdater::AppPackChanged, base::Unretained(this))); | 80 base::Bind(&AppPackUpdater::AppPackChanged, base::Unretained(this))); |
81 | 81 |
82 if (install_attributes_->GetMode() == DEVICE_MODE_RETAIL_KIOSK) { | 82 if (install_attributes_->GetMode() == DEVICE_MODE_RETAIL_KIOSK) { |
83 // Already in Kiosk mode, start loading. | 83 // Already in Kiosk mode, start loading. |
84 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 84 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
85 base::Bind(&AppPackUpdater::LoadPolicy, | 85 base::Bind(&AppPackUpdater::LoadPolicy, |
86 weak_ptr_factory_.GetWeakPtr())); | 86 weak_ptr_factory_.GetWeakPtr())); |
87 } else { | 87 } else { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void AppPackUpdater::SetScreenSaverPath(const base::FilePath& path) { | 209 void AppPackUpdater::SetScreenSaverPath(const base::FilePath& path) { |
210 // Don't invoke the callback if the path isn't changing. | 210 // Don't invoke the callback if the path isn't changing. |
211 if (path != screen_saver_path_) { | 211 if (path != screen_saver_path_) { |
212 screen_saver_path_ = path; | 212 screen_saver_path_ = path; |
213 if (!screen_saver_update_callback_.is_null()) | 213 if (!screen_saver_update_callback_.is_null()) |
214 screen_saver_update_callback_.Run(screen_saver_path_); | 214 screen_saver_update_callback_.Run(screen_saver_path_); |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 } // namespace policy | 218 } // namespace policy |
OLD | NEW |