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/customization_document.h" | 5 #include "chrome/browser/chromeos/customization_document.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 Profile* profile() { return profile_; } | 165 Profile* profile() { return profile_; } |
166 | 166 |
167 // Used by the ServicesCustomizationDocument to update the current apps. | 167 // Used by the ServicesCustomizationDocument to update the current apps. |
168 void SetCurrentApps(scoped_ptr<base::DictionaryValue> prefs) { | 168 void SetCurrentApps(scoped_ptr<base::DictionaryValue> prefs) { |
169 apps_.Swap(prefs.get()); | 169 apps_.Swap(prefs.get()); |
170 is_apps_set_ = true; | 170 is_apps_set_ = true; |
171 StartLoading(); | 171 StartLoading(); |
172 } | 172 } |
173 | 173 |
174 // Implementation of extensions::ExternalLoader: | 174 // Implementation of extensions::ExternalLoader: |
175 virtual void StartLoading() OVERRIDE { | 175 virtual void StartLoading() override { |
176 if (!is_apps_set_) { | 176 if (!is_apps_set_) { |
177 ServicesCustomizationDocument::GetInstance()->StartFetching(); | 177 ServicesCustomizationDocument::GetInstance()->StartFetching(); |
178 // In case of missing customization ID, SetCurrentApps will be called | 178 // In case of missing customization ID, SetCurrentApps will be called |
179 // synchronously from StartFetching and this function will be called | 179 // synchronously from StartFetching and this function will be called |
180 // recursively so we need to return to avoid calling LoadFinished twice. | 180 // recursively so we need to return to avoid calling LoadFinished twice. |
181 // In case of async load it is safe to return empty list because this | 181 // In case of async load it is safe to return empty list because this |
182 // provider didn't install any app yet so no app can be removed due to | 182 // provider didn't install any app yet so no app can be removed due to |
183 // returning empty list. | 183 // returning empty list. |
184 if (is_apps_set_) | 184 if (is_apps_set_) |
185 return; | 185 return; |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 apply_tasks_success_ += success; | 958 apply_tasks_success_ += success; |
959 | 959 |
960 if (apply_tasks_started_ != apply_tasks_finished_) | 960 if (apply_tasks_started_ != apply_tasks_finished_) |
961 return; | 961 return; |
962 | 962 |
963 if (apply_tasks_success_ == apply_tasks_finished_) | 963 if (apply_tasks_success_ == apply_tasks_finished_) |
964 SetApplied(true); | 964 SetApplied(true); |
965 } | 965 } |
966 | 966 |
967 } // namespace chromeos | 967 } // namespace chromeos |
OLD | NEW |