#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_file_job.h"
#include "net/url_request/url_request_simple_job.h"
-#include "xwalk/runtime/browser/xwalk_runner.h"
#include "xwalk/application/browser/application_service.h"
#include "xwalk/application/common/application_data.h"
#include "xwalk/application/common/application_file_util.h"
#include "xwalk/application/common/application_resource.h"
#include "xwalk/application/common/constants.h"
#include "xwalk/application/common/manifest_handlers/csp_handler.h"
+#include "xwalk/runtime/common/xwalk_system_locale.h"
using content::BrowserThread;
using content::ResourceRequestInfo;
// The |locale| should be expanded to user agent locale.
// Such as, "en-us" will be expaned as "en-us, en".
void GetUserAgentLocales(const std::string& sys_locale,
- std::list<std::string>& ua_locales) {
+ std::list<std::string>& ua_locales) { // NOLINT
if (sys_locale.empty())
return;
- std::string locale = StringToLowerASCII(sys_locale);
+ std::string locale = base::StringToLowerASCII(sys_locale);
size_t position;
do {
ua_locales.push_back(locale);
const std::string& application_id = request->url().host();
scoped_refptr<ApplicationData> application =
cache_.GetApplicationData(application_id);
+
+ if (!application)
+ return new net::URLRequestErrorJob(
+ request, network_delegate, net::ERR_FILE_NOT_FOUND);
+
base::FilePath relative_path =
ApplicationURLToRelativeFilePath(request->url());
base::FilePath directory_path;
if (application) {
directory_path = application->Path();
- const char* csp_key = GetCSPKey(application->GetPackageType());
+ const char* csp_key = GetCSPKey(application->manifest_type());
const CSPInfo* csp_info = static_cast<CSPInfo*>(
application->GetManifestData(csp_key));
if (csp_info) {
}
}
- const std::string& path = request->url().path();
-
std::list<std::string> locales;
- if (application && application->GetPackageType() == Package::WGT) {
- GetUserAgentLocales(
- xwalk::XWalkRunner::GetInstance()->GetLocale(), locales);
+ if (application && application->manifest_type() == Manifest::TYPE_WIDGET) {
+ GetUserAgentLocales(GetSystemLocale(), locales);
GetUserAgentLocales(application->GetManifest()->default_locale(), locales);
}