#if defined(OS_TIZEN)
content::WebContentsViewDelegate* AtomBrowserClient::GetWebContentsViewDelegate(
content::WebContents* web_contents) {
- auto tizen_view = new tizen::TizenWebContentsView(web_contents);
+ auto tizen_view = new tizen::TizenWebContentsView(web_contents, atom::Browser::Get()->window());
std::unique_ptr<tizen::TizenWebContentsView> p(tizen_view);
tizen_views_.push_back(std::move(p));
return new tizen::TizenWebContentsViewDelegate(tizen_view);
tizen_views_.end());
}
-tizen::TizenWebContentsView* AtomBrowserClient::GetTizenWebContentsView(content::WebContents* web_contents) {
+tizen::TizenWebContentsView* AtomBrowserClient::GetTizenWebContentsView(
+ const content::WebContents* web_contents) {
for (auto& it: tizen_views_) {
if (it->web_contents() == web_contents)
return it.get();
const std::vector<std::string>& schemes);
#if defined(OS_TIZEN)
- static tizen::TizenWebContentsView* GetTizenWebContentsView(content::WebContents* web_contents);
+ static tizen::TizenWebContentsView* GetTizenWebContentsView(const content::WebContents* web_contents);
static void RemoveTizenWebContentsView(content::WebContents* web_contents);
#endif
// found in the LICENSE file.
#include "atom/browser/atom_javascript_modal_dialog_efl.h"
+#include "atom/browser/browser.h"
+#include "atom/browser/native_window_efl.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
const base::string16& message_text,
const base::string16& default_prompt_text,
const content::JavaScriptDialogManager::DialogClosedCallback& callback)
- : web_view_(atom::NativeWindow::FromWebContents(web_contents)),
- window_(nullptr),
+ : window_(nullptr),
conformant_(nullptr),
popup_(nullptr),
prompt_entry_(nullptr),
}
bool AtomJavaScriptModalDialogEfl::ShowJavaScriptDialog() {
- Evas_Object* top_window = static_cast<atom::NativeWindowEfl*>(web_view_)->evas_object();
+ Evas_Object* top_window = atom::Browser::Get()->window();
popup_ = CreatePopupOnNewWindow(top_window);
if (!popup_)
#include <Evas.h>
#include <string>
-#include "atom/browser/native_window_efl.h"
#include "base/strings/string16.h"
#include "content/public/browser/javascript_dialog_manager.h"
#include "url/gurl.h"
void* event_info);
static void OkButtonCallback(void* data, Evas_Object* obj, void* event_info);
- atom::NativeWindow* web_view_;
Evas_Object* window_;
Evas_Object* conformant_;
Evas_Object* popup_;
#include <watch_app_efl.h>
#endif
+#include "atom/browser/browser.h"
+#include "atom/browser/atom_browser_client.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "content/public/browser/web_contents.h"
namespace {
-std::map<const content::WebContents*, Evas_Object*> window_map_;
int window_width_;
int window_height_;
Evas_Object* NativeWindowEfl::GetHostWindowDelegate(const content::WebContents* web_contents) {
LOG(ERROR) << "NativeWindowEfl::GetHostWindowDelegate";
- if (window_map_.find(web_contents) != window_map_.end())
- return window_map_[web_contents];
-
- Evas_Object* win = NULL;
- auto app_data = common::ApplicationDataManager::GetCurrentAppData();
-#if !defined(OS_TIZEN_TV_PRODUCT)
- if (app_data->app_type() == common::ApplicationData::WATCH) {
- elm_config_accel_preference_set("opengl");
- watch_app_get_elm_win(&win);
- elm_win_alpha_set(win, EINA_TRUE);
- evas_object_render_op_set(win, EVAS_RENDER_COPY);
- }
- else {
-#endif
- win = elm_win_util_standard_add("", "");
- elm_win_autodel_set(win, EINA_TRUE);
-#if !defined(OS_TIZEN_TV_PRODUCT)
- }
-#endif
-
- window_map_[web_contents] = win;
- return win;
+ return atom::AtomBrowserClient::GetTizenWebContentsView(web_contents)->evas_object();
}
NativeWindowEfl::NativeWindowEfl(
DCHECK(window_);
- elm_win_screen_size_get(window_, NULL, NULL, &window_width_, &window_height_);
+ atom::Browser::Get()->GetWindowDimensions(window_width_, window_height_);
evas_object_smart_callback_add(window_, "delete,request",
OnWindowDeleteRequest, this);
evas_object_resize(window_, window_width_, window_height_);
- Evas_Object* box = elm_box_add(window_);
- evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(window_, box);
- evas_object_show(box);
+ evas_object_size_hint_align_set(window_, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(window_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(window_);
web_view_ = static_cast<Evas_Object*>(web_contents()->GetNativeView());
evas_object_size_hint_align_set(web_view_, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(web_view_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_box_pack_end(box, web_view_);
+ elm_box_pack_end(window_, web_view_);
evas_object_resize(web_view_, window_width_, window_height_);
&HWBackKeyCallback, this);
eext_object_event_callback_add(web_view_, EEXT_CALLBACK_MORE,
&HWMoreKeyCallback, this);
-
- if (elm_win_wm_rotation_supported_get(window_)) {
- int rots[4] = {0, 90, 180, 270};
- elm_win_wm_rotation_available_rotations_set(window_,
- (const int *)(&rots), 4);
-
- // Registering nullptr as Callback, but window will rotate without error.
- // Is it right action?
- evas_object_smart_callback_add(window_,
- "wm,rotation,changed",
- nullptr,
- this);
- } else {
- LOG(ERROR) << __func__ << " Window does not support rotation";
- }
#endif
#if defined(OS_TIZEN_TV_PRODUCT)
// static
void WindowList::AddWindow(NativeWindow* window) {
DCHECK(window);
+ if (GetLastWindow())
+ GetLastWindow()->Hide();
// Push |window| on the appropriate list instance.
WindowVector& windows = GetInstance()->windows_;
windows.push_back(window);
WindowVector& windows = GetInstance()->windows_;
windows.erase(std::remove(windows.begin(), windows.end(), window),
windows.end());
-
+ if (GetLastWindow())
+ GetLastWindow()->Show();
for (WindowListObserver& observer : observers_.Get())
observer.OnWindowRemoved(window);
*/
#include <app.h>
+#include <Elementary.h>
+#if !defined(OS_TIZEN_TV_PRODUCT)
+#include <watch_app_efl.h>
+#endif
#include "atom/common/api/api_messages.h"
#include "common/string_utils.h"
is_suspended_(false) {
}
+TizenBrowserParts::~TizenBrowserParts() {
+ evas_object_del(window_);
+ window_ = nullptr;
+}
+
+void TizenBrowserParts::InitializeWindow() {
+ auto app_data = common::ApplicationDataManager::GetCurrentAppData();
+#if !defined(OS_TIZEN_TV_PRODUCT)
+ if (app_data->app_type() == common::ApplicationData::WATCH) {
+ elm_config_accel_preference_set("opengl");
+ watch_app_get_elm_win(&window_);
+ elm_win_alpha_set(window_, EINA_TRUE);
+ evas_object_render_op_set(window_, EVAS_RENDER_COPY);
+ }
+ else {
+#endif
+ window_ = elm_win_util_standard_add("", "");
+ elm_win_autodel_set(window_, EINA_TRUE);
+#if !defined(OS_TIZEN_TV_PRODUCT)
+ }
+#endif
+ int window_width_, window_height_;
+ elm_win_screen_size_get(window_, NULL, NULL, &window_width_, &window_height_);
+ evas_object_resize(window_, window_width_, window_height_);
+ evas_object_show(window_);
+ if (elm_win_wm_rotation_supported_get(window_)) {
+ int rots[4] = {0, 90, 180, 270};
+ elm_win_wm_rotation_available_rotations_set(window_,
+ (const int *)(&rots), 4);
+
+ // Registering nullptr as Callback, but window will rotate without error.
+ // Is it right action?
+ evas_object_smart_callback_add(window_,
+ "wm,rotation,changed",
+ nullptr,
+ this);
+ } else {
+ LOG(ERROR) << __func__ << " Window does not support rotation";
+ }
+}
+
+void TizenBrowserParts::GetWindowDimensions(int& width, int& height) {
+ elm_win_screen_size_get(window_, NULL, NULL, &width, &height);
+}
+
void TizenBrowserParts::Initialize() {
app_data_ = common::ApplicationDataManager::GetCurrentAppData();
resource_manager_.reset(new common::ResourceManager(app_data_, locale_manager_.get()));
}
tizen::VibrationManager::CreateInstance();
+ InitializeWindow();
}
void TizenBrowserParts::ClearCookie() {
#ifndef TIZEN_BROWSER_TIZEN_BROWSER_PARTS_H_
#define TIZEN_BROWSER_TIZEN_BROWSER_PARTS_H_
+#include <Evas.h>
+
#include "content/public/browser/render_view_host.h"
#include "tizen/common/app_control.h"
#include "tizen/common/application_data.h"
std::string GetEncodingType();
bool ShouldAllowNavigation(const std::string &url);
void Initialize();
+ void GetWindowDimensions(int& width, int& height);
+ Evas_Object* window() { return window_; }
void ClearCookie();
CookieManager* GetCookieManager() { return cookie_manager_; }
protected:
std::unique_ptr<common::LocaleManager> locale_manager_;
std::unique_ptr<common::ResourceManager> resource_manager_;
- virtual ~TizenBrowserParts() {}
+ virtual ~TizenBrowserParts();
private:
#if defined(TIZEN_VIDEO_HOLE)
void EnableVideoHole(content::RenderViewHost* render_view_host);
#endif
-
+ void InitializeWindow();
void SetLongPollingTimeout(content::RenderViewHost* render_view_host);
+ Evas_Object* window_;
common::ApplicationData* app_data_;
CookieManager* cookie_manager_;
int security_model_version_;
* limitations under the License.
*/
+#include <Elementary.h>
+
#include "tizen_web_contents_view.h"
namespace tizen {
-TizenWebContentsView::TizenWebContentsView(content::WebContents* web_contents)
- : web_contents_(web_contents) {}
+TizenWebContentsView::TizenWebContentsView(content::WebContents* web_contents, Evas_Object* window)
+ : web_contents_(web_contents) {
+ evas_object_ = elm_box_add(window);
+ evas_object_size_hint_align_set(evas_object_, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(evas_object_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(window, evas_object_);
+}
} // namespace tizen
#ifndef TIZEN_BROWSER_TIZEN_WEB_CONTENTS_VIEW_H_
#define TIZEN_BROWSER_TIZEN_WEB_CONTENTS_VIEW_H_
+#include <Evas.h>
+
#include "content/public/common/context_menu_params.h"
#include "content/public/browser/web_contents.h"
#include "ui/gfx/geometry/rect.h"
class TizenWebContentsView {
public:
- TizenWebContentsView(content::WebContents* web_contents);
+ TizenWebContentsView(content::WebContents* web_contents, Evas_Object* window);
content::WebContents* web_contents() { return web_contents_; }
void HandleLongPressGesture(const content::ContextMenuParams&) {}
void ShowContextMenu(const content::ContextMenuParams&) {}
void OnSelectionRectReceived(const gfx::Rect& selection_rect) const {}
+ Evas_Object* evas_object() { return evas_object_; }
private:
content::WebContents* web_contents_;
+ Evas_Object* evas_object_;
};
} // namespace tizen