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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 public base::SupportsWeakPtr<ServicesCustomizationExternalLoader> { | 85 public base::SupportsWeakPtr<ServicesCustomizationExternalLoader> { |
86 public: | 86 public: |
87 explicit ServicesCustomizationExternalLoader(Profile* profile) | 87 explicit ServicesCustomizationExternalLoader(Profile* profile) |
88 : is_apps_set_(false), profile_(profile) {} | 88 : is_apps_set_(false), profile_(profile) {} |
89 | 89 |
90 Profile* profile() { return profile_; } | 90 Profile* profile() { return profile_; } |
91 | 91 |
92 // Used by the ServicesCustomizationDocument to update the current apps. | 92 // Used by the ServicesCustomizationDocument to update the current apps. |
93 void SetCurrentApps(scoped_ptr<base::DictionaryValue> prefs) { | 93 void SetCurrentApps(scoped_ptr<base::DictionaryValue> prefs) { |
94 apps_.Swap(prefs.get()); | 94 apps_.Swap(prefs.get()); |
| 95 is_apps_set_ = true; |
95 StartLoading(); | 96 StartLoading(); |
96 } | 97 } |
97 | 98 |
98 // Implementation of extensions::ExternalLoader: | 99 // Implementation of extensions::ExternalLoader: |
99 virtual void StartLoading() OVERRIDE { | 100 virtual void StartLoading() OVERRIDE { |
100 if (!is_apps_set_) { | 101 if (!is_apps_set_) { |
101 ServicesCustomizationDocument::GetInstance()->StartFetching(); | 102 ServicesCustomizationDocument::GetInstance()->StartFetching(); |
102 // No return here to call LoadFinished with empty list initially. | 103 // No return here to call LoadFinished with empty list initially. |
103 // When manifest is fetched, it will be called again with real list. | 104 // When manifest is fetched, it will be called again with real list. |
104 // It is safe to return empty list because this provider didn't install | 105 // It is safe to return empty list because this provider didn't install |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 // StartFetching will be called from ServicesCustomizationExternalLoader | 544 // StartFetching will be called from ServicesCustomizationExternalLoader |
544 // when StartLoading is called. We can't initiate manifest fetch here | 545 // when StartLoading is called. We can't initiate manifest fetch here |
545 // because caller may never call StartLoading for the provider. | 546 // because caller may never call StartLoading for the provider. |
546 } | 547 } |
547 } | 548 } |
548 | 549 |
549 return loader; | 550 return loader; |
550 } | 551 } |
551 | 552 |
552 } // namespace chromeos | 553 } // namespace chromeos |
OLD | NEW |