Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Unified Diff: mojo/shell/loader.cc

Issue 302173003: Mojo: Make mojo_shell able to load apps from file: URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/loader.cc
diff --git a/mojo/shell/loader.cc b/mojo/shell/loader.cc
index f537717efa40634ccc152bd86850406153763581..d1c335545a91627d6eb6638fb3dab6b6240e3857 100644
--- a/mojo/shell/loader.cc
+++ b/mojo/shell/loader.cc
@@ -34,16 +34,21 @@ void Loader::Job::OnURLFetchComplete(const net::URLFetcher* source) {
LOG(ERROR) << "URL fetch didn't succeed: status = " << status.status()
<< ", error = " << status.error();
} else if (source->GetResponseCode() != 200) {
- LOG(ERROR) << "HTTP response not OK: code = " << source->GetResponseCode();
+ // Note: We may not have a response code (e.g., if it wasn't an http: URL).
+ LOG(WARNING) << "HTTP response not OK: code = "
+ << source->GetResponseCode();
}
// TODO: Do something else in the error cases?
base::FilePath app_path;
source->GetResponseAsFilePath(true, &app_path);
std::string mime_type;
- std::string* passed_mime_type =
- source->GetResponseHeaders()->GetMimeType(&mime_type) ? &mime_type : NULL;
- delegate_->DidCompleteLoad(source->GetURL(), app_path, passed_mime_type);
+ // We may not have response headers (e.g., if it was a file: URL).
+ if (source->GetResponseHeaders())
+ source->GetResponseHeaders()->GetMimeType(&mime_type);
+ delegate_->DidCompleteLoad(source->GetURL(),
+ app_path,
+ mime_type.empty() ? NULL : &mime_type);
}
Loader::Loader(base::SingleThreadTaskRunner* network_runner,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698