OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/webui/extensions/extension_loader_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_loader_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 base::Bind(&ReadFileToString, file_path.Append(kManifestFilename)), | 164 base::Bind(&ReadFileToString, file_path.Append(kManifestFilename)), |
165 base::Bind(&ExtensionLoaderHandler::AddFailure, | 165 base::Bind(&ExtensionLoaderHandler::AddFailure, |
166 weak_ptr_factory_.GetWeakPtr(), | 166 weak_ptr_factory_.GetWeakPtr(), |
167 file_path, | 167 file_path, |
168 error, | 168 error, |
169 line)); | 169 line)); |
170 } | 170 } |
171 | 171 |
172 void ExtensionLoaderHandler::DidStartNavigationToPendingEntry( | 172 void ExtensionLoaderHandler::DidStartNavigationToPendingEntry( |
173 const GURL& url, | 173 const GURL& url, |
174 content::NavigationController::ReloadType reload_type) { | 174 content::ReloadType reload_type) { |
175 // In the event of a page reload, we ensure that the frontend is not notified | 175 // In the event of a page reload, we ensure that the frontend is not notified |
176 // until the UI finishes loading, so we set |ui_ready_| to false. This is | 176 // until the UI finishes loading, so we set |ui_ready_| to false. This is |
177 // balanced in HandleDisplayFailures, which is called when the frontend is | 177 // balanced in HandleDisplayFailures, which is called when the frontend is |
178 // ready to receive failure notifications. | 178 // ready to receive failure notifications. |
179 if (reload_type != content::NavigationController::NO_RELOAD) | 179 if (reload_type != content::ReloadType::NONE) |
180 ui_ready_ = false; | 180 ui_ready_ = false; |
181 } | 181 } |
182 | 182 |
183 void ExtensionLoaderHandler::AddFailure( | 183 void ExtensionLoaderHandler::AddFailure( |
184 const base::FilePath& file_path, | 184 const base::FilePath& file_path, |
185 const std::string& error, | 185 const std::string& error, |
186 size_t line_number, | 186 size_t line_number, |
187 const std::string& manifest) { | 187 const std::string& manifest) { |
188 failed_paths_.push_back(file_path); | 188 failed_paths_.push_back(file_path); |
189 base::FilePath prettified_path = path_util::PrettifyPath(file_path); | 189 base::FilePath prettified_path = path_util::PrettifyPath(file_path); |
(...skipping 17 matching lines...) Expand all Loading... |
207 NotifyFrontendOfFailure(); | 207 NotifyFrontendOfFailure(); |
208 } | 208 } |
209 | 209 |
210 void ExtensionLoaderHandler::NotifyFrontendOfFailure() { | 210 void ExtensionLoaderHandler::NotifyFrontendOfFailure() { |
211 web_ui()->CallJavascriptFunctionUnsafe( | 211 web_ui()->CallJavascriptFunctionUnsafe( |
212 "extensions.ExtensionLoader.notifyLoadFailed", failures_); | 212 "extensions.ExtensionLoader.notifyLoadFailed", failures_); |
213 failures_.Clear(); | 213 failures_.Clear(); |
214 } | 214 } |
215 | 215 |
216 } // namespace extensions | 216 } // namespace extensions |
OLD | NEW |