1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
6 #ifndef XWALK_RUNTIME_RENDERER_XWALK_RENDER_PROCESS_OBSERVER_GENERIC_H_
7 #define XWALK_RUNTIME_RENDERER_XWALK_RENDER_PROCESS_OBSERVER_GENERIC_H_
11 #include "base/compiler_specific.h"
12 #include "content/public/renderer/render_process_observer.h"
14 #include "v8/include/v8.h"
15 #include "xwalk/application/browser/application_security_policy.h"
23 // FIXME: Using filename "xwalk_render_process_observer_generic.cc(h)" temporary
24 // , due to the conflict filename with Android port.
25 // A RenderViewObserver implementation used for handling XWalkView
26 // specific render-process wide IPC messages.
27 class XWalkRenderProcessObserver : public content::RenderProcessObserver {
29 XWalkRenderProcessObserver();
30 virtual ~XWalkRenderProcessObserver();
32 // content::RenderProcessObserver implementation.
33 bool OnControlMessageReceived(const IPC::Message& message) override;
34 void WebKitInitialized() override;
35 void OnRenderProcessShutdown() override;
37 bool IsWarpMode() const {
38 return security_mode_ == application::ApplicationSecurityPolicy::WARP;
40 bool IsCSPMode() const {
41 return security_mode_ == application::ApplicationSecurityPolicy::CSP;
44 const GURL& app_url() const { return app_url_; }
46 std::string GetOverridenUserAgent() const;
50 void OnSetAccessWhiteList(
51 const GURL& source, const GURL& dest, bool allow_subdomains);
52 void OnEnableSecurityMode(
54 application::ApplicationSecurityPolicy::SecurityMode mode);
55 void OnSuspendJSEngine(bool is_pause);
57 void OnUserAgentChanged(const std::string& userAgentString);
58 std::string overriden_user_agent_;
61 bool is_blink_initialized_;
63 application::ApplicationSecurityPolicy::SecurityMode security_mode_;
68 #endif // XWALK_RUNTIME_RENDERER_XWALK_RENDER_PROCESS_OBSERVER_GENERIC_H_