}
#endif
-#if defined(USE_EFL)
+#if defined(OS_TIZEN)
void Window::OnSuspend() {
Emit("app-on-suspend");
}
void Window::OnResume() {
Emit("app-on-resume");
}
+
+void Window::OnAppControl() {
+ Emit("app-on-appcontrol");
+}
#endif
// static
void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) override;
#endif
-#if defined(USE_EFL)
+#if defined(OS_TIZEN)
void OnSuspend();
void OnResume();
+ void OnAppControl();
#endif
private:
WindowList::RemoveObserver(this);
}
+#if defined(OS_TIZEN)
const char* kAppControlMain = "http://tizen.org/appcontrol/operation/main";
const char* kAppControlEventScript =
"(function(){"
"})()";
const char* kDefaultCSPRule =
"default-src *; script-src 'self'; style-src 'self'; object-src 'none';";
+#endif
// static
Browser* Browser::Get() {
}
}
+#if defined(OS_TIZEN)
void Browser::Hide() {
- for (BrowserObserver& observer : observers_)
- observer.OnSuspend();
+ NativeWindow *last_window = WindowList::GetLastWindow();
+ if (last_window)
+ last_window->NotifySuspend();
}
void Browser::Show() {
- for (BrowserObserver& observer : observers_)
- observer.OnResume();
+ NativeWindow *last_window = WindowList::GetLastWindow();
+ if (last_window)
+ last_window->NotifyResume();
}
void Browser::Initialize() {
auto appdata = common::ApplicationDataManager::GetCurrentAppData();
resource_manager_.reset(new common::ResourceManager(appdata, locale_manager_.get()));
+ resource_manager_->set_base_resource_path(appdata->application_path());
}
void Browser::AppControl(std::unique_ptr<common::AppControl> appcontrol) {
void Browser::Launch(std::unique_ptr<common::AppControl> appcontrol) {
launched_ = true;
//To do:Implementation of relaunching of app
+ std::unique_ptr<common::ResourceManager::Resource> res =
+ resource_manager_->GetStartResource(appcontrol.get());
+ if (res)
+ start_url_ = resource_manager_->GetLocalizedPath(res->uri());
+
+ NativeWindow *last_window = WindowList::GetLastWindow();
+ if (last_window)
+ last_window->NotifyAppControl();
}
-#if defined(OS_TIZEN)
void Browser::SetSplashScreen() {
auto appdata = common::ApplicationDataManager::GetCurrentAppData();
Evas_Object* window_ = elm_win_util_standard_add("", "");
#include "base/strings/string16.h"
#include "base/values.h"
#include "native_mate/arguments.h"
+#if defined(OS_TIZEN)
+#include "atom/browser/splash_screen.h"
#include "tizen/common/app_control.h"
#include "tizen/common/application_data.h"
#include "tizen/common/resource_manager.h"
#include "tizen/common/locale_manager.h"
-#if defined(OS_TIZEN)
-#include "atom/browser/splash_screen.h"
#endif // defined(OS_TIZEN)
// Set/Get the badge count.
bool SetBadgeCount(int count);
- bool launched() const { return launched_; }
+
int GetBadgeCount();
// Set/Get the login item settings of the app
void SetLoginItemSettings(LoginItemSettings settings);
LoginItemSettings GetLoginItemSettings(const LoginItemSettings& options);
+#if defined(OS_TIZEN)
void Hide();
void Show();
void AppControl(std::unique_ptr<common::AppControl> appcontrol);
void Launch(std::unique_ptr<common::AppControl> appcontrol);
void SendAppControlEvent();
-#if defined(OS_TIZEN)
void SetSplashScreen();
void HideSplashScreen(int reason);
+ bool launched() const { return launched_; }
+ std::string StartURL() const { return start_url_;}
#endif // defined(OS_TIZEN)
#if defined(OS_MACOSX)
std::unique_ptr<common::ResourceManager> resource_manager_;
std::unique_ptr<common::LocaleManager> locale_manager_;
std::unique_ptr<SplashScreen> splash_screen_;
+ std::string start_url_;
bool launched_;
bool is_electron_launch_;
#endif
// The browser's accessibility suppport has changed.
virtual void OnAccessibilitySupportChanged() {}
- virtual void OnSuspend() {}
- virtual void OnResume() {}
#if defined(OS_MACOSX)
// The browser wants to resume a user activity via handoff. (macOS only)
virtual void OnContinueUserActivity(
}
#endif
+#if defined(OS_TIZEN)
+void NativeWindow::NotifySuspend()
+{
+ for (NativeWindowObserver& observer : observers_)
+ observer.OnSuspend();
+}
+
+void NativeWindow::NotifyResume()
+{
+ for (NativeWindowObserver& observer : observers_)
+ observer.OnResume();
+}
+
+void NativeWindow::NotifyAppControl()
+{
+ for (NativeWindowObserver& observer : observers_)
+ observer.OnAppControl();
+}
+#endif
+
std::unique_ptr<SkRegion> NativeWindow::DraggableRegionsToSkRegion(
const std::vector<DraggableRegion>& regions) {
std::unique_ptr<SkRegion> sk_region(new SkRegion);
void NotifyWindowMessage(UINT message, WPARAM w_param, LPARAM l_param);
#endif
+#if defined(OS_TIZEN)
+ void NotifySuspend();
+ void NotifyResume();
+ void NotifyAppControl();
+#endif
void AddObserver(NativeWindowObserver* obs) {
observers_.AddObserver(obs);
}
// Called on Windows when App Commands arrive (WM_APPCOMMAND)
virtual void OnExecuteWindowsCommand(const std::string& command_name) {}
+
+#if defined(OS_TIZEN)
+ // Tizen
+ virtual void OnSuspend() {}
+ virtual void OnResume() {}
+ virtual void OnAppControl() {}
+#endif
};
} // namespace atom
std::unique_ptr<ResourceManager::Resource> ResourceManager::GetStartResource(
const AppControl* app_control) {
+
+ if (!app_control) {
+ LOGGER(ERROR) << "ERROR: No app control";
+ return GetDefaultResource();
+ }
+
std::string operation = app_control->operation();
if (operation.empty()) {
LOGGER(ERROR) << "operation(mandatory) is NULL";
}
std::string WebRuntime::GetPath() const {
+ atom::Browser* browser_model = atom::Browser::Get();
+ if (browser_model) {
+ std::string res = browser_model->StartURL();
+ if (!res.empty()) {
+ LOG(ERROR) << "PWRT Start URL = " << res;
+ return res;
+ }
+ }
+
+ // Fall back: This code must ideally not execute
auto app_data = common::ApplicationDataManager::GetCurrentAppData();
if (!app_data) {
return std::string();
}
- // TODO: Use resource-manager's GetStartResource() for localized urls
base::FilePath path(app_data->application_path());
if (app_data->content_info()) {
path = path.Append(app_data->content_info()->src());
path = path.Append("index.html");
}
std::string app_path = "file://" + path.value();
+ LOG(ERROR) << "PWRT Start Url = " << app_path;
return app_path;
}
this.handleEvents(winopt);
this.appID = options.appID;
webwindow_debug('this.appID ' + this.appID);
- this.setUrl(options.path);
}
getBrowserWindowOption() {
return {
webwindow_debug('WebWindow : app-on-resume');
events.emit(WAS_EVENT.WEBAPPLICATION.RESUME, 'web_window', self.mainWindow.id);
});
+ this.mainWindow.on('app-on-appcontrol', function() {
+ webwindow_debug('WebWindow : app-on-appcontrol');
+ self.setUrl('');
+ });
this.mainWindow.webContents.on('crashed', function() {
webwindow_debug('WebWindow : webContents crashed');
self.webApplication.exit(100);
});
}
setUrl(path) {
+ webwindow_debug('WebWindow : Set URL');
if (path && (path.trim() != '')) {
this.mainWindow.loadURL(path);
} else {