}
void Initialize(const std::string& app_id) {
app_data_.reset(new ApplicationData(app_id));
+ app_data_->LoadManifestData();
locale_manager_.reset(new LocaleManager);
locale_manager_->EnableAutoUpdate(true);
if (app_data_->widget_info() != NULL &&
}
resource_manager_.reset(new ResourceManager(app_data_.get(),
locale_manager_.get()));
+ resource_manager_->set_base_resource_path(
+ app_data_->application_path());
}
- ResourceManager* resource_manager();
+ ResourceManager* resource_manager() {
+ return resource_manager_.get();
+ }
private:
BundleGlobalData() {}
*new_url = res_manager->GetLocalizedPath(*old_url);
}
-extern "C" void DynamicDatabaseAttach(const char* tizen_id) {
- LOGGER(DEBUG) << "InjectedBundle::DynamicDatabaseAttach !!" << tizen_id;
+extern "C" void DynamicDatabaseAttach(int /*attach*/) {
+ LOGGER(DEBUG) << "InjectedBundle::DynamicDatabaseAttach !!";
}
extern "C" void DynamicOnIPCMessage(const Ewk_IPC_Wrt_Message_Data& data) {
url.resize(pos);
}
- if (url.compare(app_scheme) == 0) {
+ if (utils::StartsWith(url, app_scheme)) {
// remove "app://"
url.erase(0, app_scheme.length());
// remove app id + /
std::string check = appid_ + "/";
- if (url.compare(0, check.length(), check) == 0) {
+ if (utils::StartsWith(url, check)) {
url.erase(0, check.length());
} else {
LOGGER(ERROR) << "Invalid appid";
return result;
}
- } else if (url.compare(file_scheme) == 0) {
+ } else if (utils::StartsWith(url, file_scheme)) {
// remove "file:///"
url.erase(0, file_scheme.length());
}
return result;
}
- auto locales = locale_manager_->system_locales().begin();
- for ( ; locales != locale_manager_->system_locales().end(); ++locales) {
+ for (auto& locales : locale_manager_->system_locales()) {
// check ../locales/
std::string app_locale_path = resource_base_path_ + locale_path;
if (!Exists(app_locale_path)) {
break;
}
- std::string resource_path = app_locale_path + (*locales) + "/" + url;
+ std::string resource_path = app_locale_path + locales + "/" + url;
if (Exists(resource_path)) {
- result = resource_path + suffix;
+ result = "file://" + resource_path + suffix;
return result;
}
}
std::string default_locale = resource_base_path_ + url;
if (Exists(default_locale)) {
- result = default_locale + suffix;
+ result = "file://" + default_locale + suffix;
return result;
}
result = url + suffix;