const char kEnableViewMode[] = "enable-view-mode";
const char kInjectedBundlePath[] = "injected-bundle-path";
+// Widget Info
+const char kTizenId[] = "widget-id";
+const char kWidgetScale[] = "widget-scale";
+const char kWidgetTheme[] = "widget-theme";
+const char kWidgetEncodedBundle[] = "widget-encoded-bundle";
+
// Don't dump stuff here, follow the same order as the header.
} // namespace switches
// different modes using CSS Media Queries.
CONTENT_EXPORT extern const char kEnableViewMode[];
CONTENT_EXPORT extern const char kInjectedBundlePath[];
+CONTENT_EXPORT extern const char kTizenId[];
+CONTENT_EXPORT extern const char kWidgetScale[];
+CONTENT_EXPORT extern const char kWidgetTheme[];
+CONTENT_EXPORT extern const char kWidgetEncodedBundle[];
// DON'T ADD RANDOM STUFF HERE. Put it in the main section above in
// alphabetical order, or in one of the ifdefs (also in order in each section).
IPC_ENUM_TRAITS(blink::WebViewMode)
-IPC_MESSAGE_CONTROL4(WrtMsg_SetWidgetInfo,
- std::string, // result: tizen_id
- double, // result: scale
- std::string, // result: theme
- std::string) // result: encodedBundle
-
IPC_MESSAGE_CONTROL2(WrtMsg_ParseUrl,
int, // result: request_id
GURL) // result: url
#include "command_line_efl.h"
#include "base/memory/scoped_ptr.h"
+#include "base/strings/string_number_conversions.h"
#include "browser_main_parts_efl.h"
#include "browser_context_efl.h"
#include "eweb_context.h"
host->GetBrowserContext())->WebContext()) {
const std::string& injectedBundlePath =
context->GetInjectedBundlePath();
- if (!injectedBundlePath.empty())
+ if (!injectedBundlePath.empty()) {
command_line->AppendSwitchASCII(
switches::kInjectedBundlePath, injectedBundlePath);
+
+ const std::string& tizen_id = context->GetTizenId();
+ command_line->AppendSwitchASCII(
+ switches::kTizenId, tizen_id);
+
+ double scale = context->GetWidgetScale();
+ command_line->AppendSwitchASCII(
+ switches::kWidgetScale, base::DoubleToString(scale));
+
+ const std::string& widget_theme =
+ context->GetWidgetTheme();
+ command_line->AppendSwitchASCII(
+ switches::kWidgetTheme, widget_theme);
+
+ const std::string& widget_encoded_bundle =
+ context->GetWidgetEncodedBundle();
+ command_line->AppendSwitchASCII(
+ switches::kWidgetEncodedBundle,
+ widget_encoded_bundle);
+ }
}
}
}
}
void EWebContext::SendWidgetInfo(const std::string& tizen_id, double scale, const string &theme, const string &encoded_bundle) {
- WrtWidgetHost::Get()->SetWidgetInfo(tizen_id, scale, theme, encoded_bundle);
+ tizen_id_ = tizen_id;
+ widget_scale_ = scale;
+ widget_theme_ = theme;
+ widget_encoded_bundle_ = encoded_bundle;
}
void EWebContext::SendWrtMessage(const Ewk_Wrt_Message_Data& data) {
EWebContext::EWebContext(bool incognito)
: m_pixmap(0),
- inspector_server_(NULL) {
+ inspector_server_(NULL),
+ widget_scale_(0) {
CHECK(EwkGlobalData::GetInstance());
browser_context_.reset(new BrowserContextEfl(this, incognito));
bool InspectorServerStop();
const std::string& GetInjectedBundlePath() const { return injected_bundle_path_; }
+ const std::string& GetTizenId() const { return tizen_id_; }
+ const std::string& GetWidgetTheme() const { return widget_theme_; }
+ const std::string& GetWidgetEncodedBundle() const { return widget_encoded_bundle_; }
+ double GetWidgetScale() const { return widget_scale_; }
private:
EWebContext(bool incognito);
scoped_ptr<Ewk_Cookie_Manager> ewk_cookie_manager_;
std::string proxy_uri_;
std::string injected_bundle_path_;
+ // widget info
+ std::string tizen_id_;
+ std::string widget_theme_;
+ std::string widget_encoded_bundle_;
+ double widget_scale_;
+
scoped_ptr<EwkDidStartDownloadCallback> start_download_callback_;
scoped_ptr<EwkMimeOverrideCallback> mime_override_callback_;
int m_pixmap;
#include "base/command_line.h"
#include "base/path_service.h"
+#include "base/strings/string_number_conversions.h"
#include "common/content_switches_efl.h"
#include "common/render_messages_ewk.h"
#include "content/common/paths_efl.h"
{
content::RenderThread* thread = content::RenderThread::Get();
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kInjectedBundlePath)) {
+ const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kInjectedBundlePath)) {
wrt_widget_.reset(new WrtWidget);
thread->AddObserver(wrt_widget_->GetObserver());
wrt_url_parser_.reset(new WrtUrlParseImpl(wrt_widget_.get()));
+
+ std::string tizen_id = command_line.GetSwitchValueASCII(
+ switches::kTizenId);
+ std::string theme = command_line.GetSwitchValueASCII(
+ switches::kWidgetTheme);
+ std::string encoded_bundle = command_line.GetSwitchValueASCII(
+ switches::kWidgetEncodedBundle);
+ std::string scale = command_line.GetSwitchValueASCII(
+ switches::kWidgetScale);
+ double scale_factor = 0;
+ base::StringToDouble(scale, &scale_factor);
+
+ wrt_widget_->SetWidgetInfo(tizen_id, scale_factor,
+ theme, encoded_bundle);
}
render_process_observer_.reset(new RenderProcessObserverEfl(this));
}
WrtWidgetHost::WrtWidgetHost()
- : message_filter_(new WrtWidgetHostMessageFilter(this)),
- in_wrt_(false) {
+ : message_filter_(new WrtWidgetHostMessageFilter(this)) {
}
void WrtWidgetHost::GetUrlForRequest(
callback.Run(GURL());
}
-void WrtWidgetHost::SetWidgetInfo(const std::string& tizen_id,
- double scale,
- const std::string& theme,
- const std::string& encoded_bundle) {
- // TODO shouldn't it be confirmed by WRT that this is really a launch
- // of the widget identified by widget_id?
- if (SendToAllRenderers(
- new WrtMsg_SetWidgetInfo(tizen_id, scale, theme, encoded_bundle))) {
- // TODO(z.kostrzewa) This should be determined (somehow) on application
- // startup. Can it be done via Application Framework/Package Manager?
- in_wrt_ = true;
- tizen_id_ = tizen_id;
- }
-}
-
void WrtWidgetHost::SendWrtMessage(
const Ewk_Wrt_Message_Data& message) {
SendToAllRenderers(new WrtMsg_SendWrtMessage(message));
}
+// It's only used by the wrt_file_protocol_handler which is not going to be used in the future
+// Candidate for deletion.
bool WrtWidgetHost::InWrt() const {
- return in_wrt_;
+ return false;
}
-const std::string& WrtWidgetHost::TizenId() const {
- return tizen_id_;
+// It's only used by the wrt_file_protocol_handler which is not going to be used in the future
+// Candidate for deletion.
+std::string WrtWidgetHost::TizenId() const {
+ return std::string();
}
void WrtWidgetHost::OnUrlRetrieved(int callback_id, const GURL& url) {
void GetUrlForRequest(net::URLRequest* request,
base::Callback<void(const GURL&)> callback);
- void SetWidgetInfo(const std::string& tizen_id, double scale, const std::string& theme,
- const std::string& encoded_bundle);
-
void SendWrtMessage(const Ewk_Wrt_Message_Data& message);
bool InWrt() const;
- const std::string& TizenId() const;
+ std::string TizenId() const;
private:
friend class WrtWidgetHostMessageFilter;
scoped_refptr<WrtWidgetHostMessageFilter> message_filter_;
base::AtomicSequenceNumber callback_id_generator_;
callbacks_type callbacks_;
- bool in_wrt_;
- std::string tizen_id_;
DISALLOW_COPY_AND_ASSIGN(WrtWidgetHost);
};
bool OnControlMessageReceived(const IPC::Message& message) override {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WrtRenderThreadObserver, message)
- IPC_MESSAGE_FORWARD(WrtMsg_SetWidgetInfo, wrt_widget_, WrtWidget::SetWidgetInfo)
IPC_MESSAGE_FORWARD(WrtMsg_SendWrtMessage, wrt_widget_, WrtWidget::MessageReceived)
IPC_MESSAGE_HANDLER(WrtMsg_ParseUrl, ParseUrl)
IPC_MESSAGE_UNHANDLED(handled = false)