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/extensions/default_app_order.h" | 5 #include "chrome/browser/chromeos/extensions/default_app_order.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_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 CHECK(loaded_.IsSignaled()); | 106 CHECK(loaded_.IsSignaled()); |
107 return app_ids_; | 107 return app_ids_; |
108 } | 108 } |
109 | 109 |
110 void ExternalLoader::Load() { | 110 void ExternalLoader::Load() { |
111 FilePath ordinals_file; | 111 FilePath ordinals_file; |
112 CHECK(PathService::Get(chrome::FILE_DEFAULT_APP_ORDER, &ordinals_file)); | 112 CHECK(PathService::Get(chrome::FILE_DEFAULT_APP_ORDER, &ordinals_file)); |
113 | 113 |
114 scoped_ptr<base::ListValue> ordinals_value( | 114 scoped_ptr<base::ListValue> ordinals_value( |
115 ReadExternalOrdinalFile(ordinals_file)); | 115 ReadExternalOrdinalFile(ordinals_file)); |
116 if (ordinals_value) { | 116 if (ordinals_value.get()) { |
117 for (size_t i = 0; i < ordinals_value->GetSize(); ++i) { | 117 for (size_t i = 0; i < ordinals_value->GetSize(); ++i) { |
118 std::string app_id; | 118 std::string app_id; |
119 CHECK(ordinals_value->GetString(i, &app_id)); | 119 CHECK(ordinals_value->GetString(i, &app_id)); |
120 app_ids_.push_back(app_id); | 120 app_ids_.push_back(app_id); |
121 } | 121 } |
122 } else { | 122 } else { |
123 GetDefault(&app_ids_); | 123 GetDefault(&app_ids_); |
124 } | 124 } |
125 | 125 |
126 loaded_.Signal(); | 126 loaded_.Signal(); |
127 } | 127 } |
128 | 128 |
129 void Get(std::vector<std::string>* app_ids) { | 129 void Get(std::vector<std::string>* app_ids) { |
130 // |loader_instance| could be NULL for test. | 130 // |loader_instance| could be NULL for test. |
131 if (!loader_instance) { | 131 if (!loader_instance) { |
132 GetDefault(app_ids); | 132 GetDefault(app_ids); |
133 return; | 133 return; |
134 } | 134 } |
135 | 135 |
136 *app_ids = loader_instance->GetAppIds(); | 136 *app_ids = loader_instance->GetAppIds(); |
137 } | 137 } |
138 | 138 |
139 } // namespace default_app_order | 139 } // namespace default_app_order |
140 } // namespace chromeos | 140 } // namespace chromeos |
OLD | NEW |