summaryrefslogtreecommitdiffstats
path: root/mojo/shell
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-11 14:38:29 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-11 14:38:29 +0000
commit033f12364a6adb6992787a8c4e737df26b1ce356 (patch)
tree88aee937eb38863c30c7828394054eee8d1f247a /mojo/shell
parente694cbf6b8832dbcb756273c84416b26171d3ec3 (diff)
downloadchromium_src-033f12364a6adb6992787a8c4e737df26b1ce356.zip
chromium_src-033f12364a6adb6992787a8c4e737df26b1ce356.tar.gz
chromium_src-033f12364a6adb6992787a8c4e737df26b1ce356.tar.bz2
Plumbs through mime type Loader::Delegate
Will use in a subsequent cl. BUG=none TEST=none R=viettrungluu@chromium.org Review URL: https://codereview.chromium.org/150733004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250406 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/shell')
-rw-r--r--mojo/shell/dynamic_service_loader.cc3
-rw-r--r--mojo/shell/loader.cc6
-rw-r--r--mojo/shell/loader.h4
-rw-r--r--mojo/shell/service_connector.cc6
-rw-r--r--mojo/shell/service_connector.h1
5 files changed, 14 insertions, 6 deletions
diff --git a/mojo/shell/dynamic_service_loader.cc b/mojo/shell/dynamic_service_loader.cc
index db3385a..f1e3de9 100644
--- a/mojo/shell/dynamic_service_loader.cc
+++ b/mojo/shell/dynamic_service_loader.cc
@@ -68,7 +68,8 @@ class DynamicServiceLoader::LoadContext
private:
// From Loader::Delegate.
virtual void DidCompleteLoad(const GURL& app_url,
- const base::FilePath& app_path) OVERRIDE {
+ const base::FilePath& app_path,
+ const std::string* mime_type) OVERRIDE {
app_path_ = app_path;
thread_.Start();
}
diff --git a/mojo/shell/loader.cc b/mojo/shell/loader.cc
index cbfe130..71d6616 100644
--- a/mojo/shell/loader.cc
+++ b/mojo/shell/loader.cc
@@ -10,6 +10,7 @@
#include "mojo/shell/switches.h"
#include "net/base/load_flags.h"
#include "net/base/network_delegate.h"
+#include "net/http/http_response_headers.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_status.h"
@@ -39,7 +40,10 @@ void Loader::Job::OnURLFetchComplete(const net::URLFetcher* source) {
base::FilePath app_path;
source->GetResponseAsFilePath(true, &app_path);
- delegate_->DidCompleteLoad(source->GetURL(), 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);
}
Loader::Loader(base::SingleThreadTaskRunner* network_runner,
diff --git a/mojo/shell/loader.h b/mojo/shell/loader.h
index ddbccd02..2279cbd 100644
--- a/mojo/shell/loader.h
+++ b/mojo/shell/loader.h
@@ -25,8 +25,10 @@ class Loader {
public:
class Delegate {
public:
+ // |mime_type| is NULL if a mime type was not specified.
virtual void DidCompleteLoad(const GURL& app_url,
- const base::FilePath& app_path) = 0;
+ const base::FilePath& app_path,
+ const std::string* mime_type) = 0;
protected:
virtual ~Delegate();
diff --git a/mojo/shell/service_connector.cc b/mojo/shell/service_connector.cc
index c073c6e..7251c85 100644
--- a/mojo/shell/service_connector.cc
+++ b/mojo/shell/service_connector.cc
@@ -37,11 +37,11 @@ class ServiceConnector::ServiceFactory : public Shell, public ErrorHandler {
connector_->RemoveServiceFactory(this);
}
- GURL url() const { return url_; }
+ const GURL& url() const { return url_; }
private:
- ServiceConnector* connector_;
- GURL url_;
+ ServiceConnector* const connector_;
+ const GURL url_;
RemotePtr<ShellClient> shell_client_;
DISALLOW_COPY_AND_ASSIGN(ServiceFactory);
};
diff --git a/mojo/shell/service_connector.h b/mojo/shell/service_connector.h
index 6b338b6..65a646e 100644
--- a/mojo/shell/service_connector.h
+++ b/mojo/shell/service_connector.h
@@ -52,6 +52,7 @@ class ServiceConnector {
Loader* GetLoaderForURL(const GURL& gurl);
// Loads a service if necessary and establishes a new client connection.
void Connect(const GURL& url, ScopedMessagePipeHandle client_handle);
+
private:
class ServiceFactory;