#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "brightray/browser/brightray_paths.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/ssl/ssl_cert_request_info.h"
+#include "tizen/common/env_variables.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image.h"
auto certs = net::X509Certificate::CreateCertificateListFromBytes(
data.c_str(), data.length(), net::X509Certificate::FORMAT_AUTO);
- if (certs.size() > 0)
+ if (!certs.empty())
delegate->ContinueWithCertificate(certs[0].get());
}
}
#endif
-void OnIconDataAvailable(const App::FileIconCallback& callback,
+void OnIconDataAvailable(v8::Isolate* isolate,
+ const App::FileIconCallback& callback,
gfx::Image* icon) {
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
- if (icon && !icon->IsEmpty()) {
+ if (!::tizen::is_single_process)
v8::Locker locker(isolate);
- v8::HandleScope handle_scope(isolate);
+ v8::HandleScope handle_scope(isolate);
+
+ if (icon && !icon->IsEmpty()) {
callback.Run(v8::Null(isolate), *icon);
} else {
v8::Local<v8::String> error_message =
} // namespace
App::App(v8::Isolate* isolate) {
- static_cast<AtomBrowserClient*>(AtomBrowserClient::Get())->set_delegate(this);
+ if (AtomBrowserClient::Get())
+ static_cast<AtomBrowserClient*>(AtomBrowserClient::Get())->set_delegate(this);
Browser::Get()->AddObserver(this);
content::GpuDataManager::GetInstance()->AddObserver(this);
Init(isolate);
int exitCode = AtomBrowserMainParts::Get()->GetExitCode();
Emit("quit", exitCode);
- if (process_singleton_.get()) {
+ if (process_singleton_) {
process_singleton_->Cleanup();
process_singleton_.reset();
}
void App::OnLogin(LoginHandler* login_handler,
const base::DictionaryValue& request_details) {
- v8::Locker locker(isolate());
+ if (!::tizen::is_single_process)
+ v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
bool prevent_default = Emit(
"login",
const scoped_refptr<content::ResourceRequestBodyImpl>& body,
int render_process_id,
int render_frame_id) {
- v8::Locker locker(isolate());
+ if (!::tizen::is_single_process)
+ v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
content::RenderFrameHost* rfh =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>&
callback) {
- v8::Locker locker(isolate());
+ if (!::tizen::is_single_process)
+ v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
bool prevent_default = Emit("certificate-error",
WebContents::CreateFrom(isolate(), web_contents),
status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED);
}
+base::FilePath App::GetAppPath() const {
+ return app_path_;
+}
+
+void App::SetAppPath(const base::FilePath& app_path) {
+ app_path_ = app_path;
+}
+
base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
bool succeed = false;
base::FilePath path;
bool App::MakeSingleInstance(
const ProcessSingleton::NotificationCallback& callback) {
- if (process_singleton_.get())
+ if (process_singleton_)
return false;
base::FilePath user_dir;
}
void App::ReleaseSingleInstance() {
- if (process_singleton_.get()) {
+ if (process_singleton_) {
process_singleton_->Cleanup();
process_singleton_.reset();
}
IconLoader::IconSize icon_size;
FileIconCallback callback;
+ if (!::tizen::is_single_process)
+ v8::Locker locker(isolate());
+ v8::HandleScope handle_scope(isolate());
+
+ base::FilePath normalized_path = path.NormalizePathSeparators();
+
if (!args->GetNext(&options)) {
icon_size = IconLoader::IconSize::NORMAL;
} else {
}
if (!args->GetNext(&callback)) {
- args->ThrowError();
+ args->ThrowError("Missing required callback function");
return;
}
- IconManager* icon_manager = IconManager::GetInstance();
- gfx::Image* icon = icon_manager->LookupIconFromFilepath(path, icon_size);
+ auto icon_manager = g_browser_process->GetIconManager();
+ gfx::Image* icon =
+ icon_manager->LookupIconFromFilepath(normalized_path, icon_size);
if (icon) {
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
- v8::Locker locker(isolate);
- v8::HandleScope handle_scope(isolate);
- callback.Run(v8::Null(isolate), *icon);
+ callback.Run(v8::Null(isolate()), *icon);
} else {
- icon_manager->LoadIcon(path, icon_size,
- base::Bind(&OnIconDataAvailable, callback));
+ icon_manager->LoadIcon(
+ normalized_path, icon_size,
+ base::Bind(&OnIconDataAvailable, isolate(), callback),
+ &cancelable_task_tracker_);
}
}
.SetMethod("isUnityRunning",
base::Bind(&Browser::IsUnityRunning, browser))
#endif
+ .SetMethod("setAppPath", &App::SetAppPath)
+ .SetMethod("getAppPath", &App::GetAppPath)
.SetMethod("setPath", &App::SetPath)
.SetMethod("getPath", &App::GetPath)
.SetMethod("setDesktopName", &App::SetDesktopName)