#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/run_loop.h"
+#include "base/strings/string16.h"
+#include "base/strings/utf_string_conversions.h"
+#include "base/values.h"
#include "base/threading/thread_task_runner_handle.h"
#include "brightray/browser/brightray_paths.h"
-
+#include "content/public/browser/render_frame_host.h"
#if defined(OS_TIZEN)
#include "tizen/common/command_line.h"
#include "tizen/common/application_data.h"
WindowList::RemoveObserver(this);
}
+const char* kAppControlMain = "http://tizen.org/appcontrol/operation/main";
+const char* kAppControlEventScript =
+ "(function(){"
+ "var __event = document.createEvent(\"CustomEvent\");\n"
+ "__event.initCustomEvent(\"appcontrol\", true, true, null);\n"
+ "document.dispatchEvent(__event);\n"
+ "\n"
+ "for(var i=0; i < window.frames.length; i++)\n"
+ "{ window.frames[i].document.dispatchEvent(__event); }"
+ "})()";
+const char* kDefaultCSPRule =
+ "default-src *; script-src 'self'; style-src 'self'; object-src 'none';";
+
// static
Browser* Browser::Get() {
if (AtomBrowserMainParts::Get())
std::unique_ptr<common::ResourceManager::Resource> res =
resource_manager_->GetStartResource(appcontrol.get());
bool do_reset = res->should_reset();
-//To do: Implementation of reset case according to parsed config file parameter.
+ NativeWindow *last_window= WindowList::GetLastWindow();
+ std::string localized_page = res->uri();
+ if(!do_reset)
+ {
+ std::string current_page=last_window->web_contents()->GetURL().spec();
+ if (current_page != localized_page) {
+ do_reset = true;
+ } else {
+ SendAppControlEvent();
+ }
+ }
+ if (do_reset && (appcontrol->operation() == kAppControlMain)) {
+ do_reset = false;
+ SendAppControlEvent();
+ }
+ if (do_reset) {
+ //To do :Implementation of ClearViewStack(), SetupWebWindow(),SetupWebWindowCompatibilitySettings() function
+ }
+}
+
+void Browser::SendAppControlEvent() {
+ std::vector<NativeWindow*> WindowVector;
+ WindowVector=WindowList::GetWindows();
+ NativeWindow *last_window= WindowList::GetLastWindow();
+ if (WindowVector.size() > 0 && last_window != NULL) {
+ content::RenderFrameHost* rfh = last_window->web_contents()->GetMainFrame();
+ if (rfh) {
+ rfh->ExecuteJavaScriptWithUserGestureForTests(
+ base::UTF8ToUTF16(kAppControlEventScript));
+ }
+ }
}
void Browser::Launch(std::unique_ptr<common::AppControl> appcontrol) {
launched_ = true;
//To do:Implementation of relaunching of app
}
-
#if defined(OS_TIZEN)
void Browser::SetSplashScreen() {
common::CommandLine* runtime_cmd = common::CommandLine::ForCurrentProcess();