2014-07-03 21:30:36 +04:00
|
|
|
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "atom/browser/native_window_views.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2014-07-16 18:10:10 +04:00
|
|
|
#include "atom/browser/ui/views/menu_bar.h"
|
|
|
|
#include "atom/browser/ui/views/menu_layout.h"
|
2014-07-07 11:35:16 +04:00
|
|
|
#include "atom/common/draggable_region.h"
|
2014-07-03 21:30:36 +04:00
|
|
|
#include "atom/common/options_switches.h"
|
|
|
|
#include "base/strings/utf_string_conversions.h"
|
2014-07-04 12:54:10 +04:00
|
|
|
#include "browser/inspectable_web_contents_view.h"
|
|
|
|
#include "content/public/browser/native_web_keyboard_event.h"
|
2014-07-03 21:30:36 +04:00
|
|
|
#include "content/public/browser/web_contents_view.h"
|
|
|
|
#include "native_mate/dictionary.h"
|
2014-07-07 18:39:39 +04:00
|
|
|
#include "ui/base/hit_test.h"
|
2014-07-03 21:30:36 +04:00
|
|
|
#include "ui/gfx/image/image.h"
|
|
|
|
#include "ui/gfx/image/image_skia.h"
|
|
|
|
#include "ui/views/background.h"
|
2014-07-07 19:02:46 +04:00
|
|
|
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
|
2014-07-03 21:30:36 +04:00
|
|
|
#include "ui/views/controls/webview/webview.h"
|
|
|
|
#include "ui/views/window/client_view.h"
|
|
|
|
#include "ui/views/widget/widget.h"
|
|
|
|
|
2014-07-07 11:35:16 +04:00
|
|
|
#if defined(USE_X11)
|
2014-07-11 04:57:19 +04:00
|
|
|
#include "atom/browser/ui/views/global_menu_bar_x11.h"
|
2014-07-07 11:35:16 +04:00
|
|
|
#include "atom/browser/ui/views/linux_frame_view.h"
|
2014-07-12 07:36:08 +04:00
|
|
|
#elif defined(OS_WIN)
|
|
|
|
#include "atom/browser/ui/views/win_frame_view.h"
|
2014-07-07 11:35:16 +04:00
|
|
|
#endif
|
|
|
|
|
2014-07-03 21:30:36 +04:00
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2014-07-16 18:10:10 +04:00
|
|
|
// The menu bar height in pixels.
|
|
|
|
const int kMenuBarHeight = 25;
|
|
|
|
|
2014-07-03 21:30:36 +04:00
|
|
|
class NativeWindowClientView : public views::ClientView {
|
|
|
|
public:
|
|
|
|
NativeWindowClientView(views::Widget* widget,
|
|
|
|
NativeWindowViews* contents_view)
|
|
|
|
: views::ClientView(widget, contents_view) {
|
|
|
|
}
|
|
|
|
virtual ~NativeWindowClientView() {}
|
|
|
|
|
|
|
|
virtual bool CanClose() OVERRIDE {
|
|
|
|
static_cast<NativeWindowViews*>(contents_view())->CloseWebContents();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(NativeWindowClientView);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
NativeWindowViews::NativeWindowViews(content::WebContents* web_contents,
|
|
|
|
const mate::Dictionary& options)
|
|
|
|
: NativeWindow(web_contents, options),
|
|
|
|
window_(new views::Widget),
|
2014-07-16 18:10:10 +04:00
|
|
|
menu_bar_(NULL),
|
2014-07-04 12:54:10 +04:00
|
|
|
web_view_(inspectable_web_contents()->GetView()->GetView()),
|
2014-07-07 19:02:46 +04:00
|
|
|
keyboard_event_handler_(new views::UnhandledKeyboardEventHandler),
|
2014-07-03 21:30:36 +04:00
|
|
|
resizable_(true) {
|
|
|
|
options.Get(switches::kResizable, &resizable_);
|
|
|
|
options.Get(switches::kTitle, &title_);
|
|
|
|
|
2014-07-12 07:36:08 +04:00
|
|
|
int width = 800, height = 600;
|
|
|
|
options.Get(switches::kWidth, &width);
|
|
|
|
options.Get(switches::kHeight, &height);
|
|
|
|
gfx::Rect bounds(0, 0, width, height);
|
|
|
|
|
2014-07-08 08:55:33 +04:00
|
|
|
window_->AddObserver(this);
|
|
|
|
|
2014-07-03 21:30:36 +04:00
|
|
|
views::Widget::InitParams params;
|
2014-07-04 13:24:49 +04:00
|
|
|
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
2014-07-12 07:36:08 +04:00
|
|
|
params.bounds = bounds;
|
2014-07-03 21:30:36 +04:00
|
|
|
params.delegate = this;
|
2014-07-07 12:10:34 +04:00
|
|
|
params.type = views::Widget::InitParams::TYPE_WINDOW;
|
2014-07-03 21:30:36 +04:00
|
|
|
params.top_level = true;
|
2014-07-12 07:36:08 +04:00
|
|
|
|
|
|
|
#if defined(USE_X11)
|
|
|
|
// In X11 the window frame is drawn by the application.
|
2014-07-04 08:32:03 +04:00
|
|
|
params.remove_standard_frame = true;
|
2014-07-16 11:33:40 +04:00
|
|
|
#elif defined(OS_WIN)
|
|
|
|
if (!has_frame_)
|
|
|
|
params.remove_standard_frame = true;
|
2014-07-12 07:36:08 +04:00
|
|
|
#endif
|
2014-07-07 13:22:22 +04:00
|
|
|
|
|
|
|
bool skip_taskbar = false;
|
|
|
|
if (options.Get(switches::kSkipTaskbar, &skip_taskbar) && skip_taskbar)
|
|
|
|
params.type = views::Widget::InitParams::TYPE_BUBBLE;
|
|
|
|
|
2014-07-03 21:30:36 +04:00
|
|
|
window_->Init(params);
|
|
|
|
|
2014-07-04 08:32:03 +04:00
|
|
|
// Add web view.
|
2014-07-16 18:10:10 +04:00
|
|
|
SetLayoutManager(new MenuLayout(kMenuBarHeight));
|
2014-07-04 08:32:03 +04:00
|
|
|
set_background(views::Background::CreateStandardPanelBackground());
|
|
|
|
AddChildView(web_view_);
|
|
|
|
|
|
|
|
bool use_content_size;
|
|
|
|
if (has_frame_ &&
|
|
|
|
options.Get(switches::kUseContentSize, &use_content_size) &&
|
|
|
|
use_content_size)
|
2014-07-16 18:10:10 +04:00
|
|
|
bounds = ContentBoundsToWindowBounds(bounds);
|
2014-07-03 21:30:36 +04:00
|
|
|
|
2014-07-04 08:32:03 +04:00
|
|
|
window_->CenterWindow(bounds.size());
|
2014-07-12 07:36:08 +04:00
|
|
|
Layout();
|
2014-07-03 21:30:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NativeWindowViews::~NativeWindowViews() {
|
2014-07-08 08:55:33 +04:00
|
|
|
window_->RemoveObserver(this);
|
2014-07-03 21:30:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::Close() {
|
|
|
|
window_->Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::CloseImmediately() {
|
|
|
|
window_->CloseNow();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::Move(const gfx::Rect& bounds) {
|
|
|
|
window_->SetBounds(bounds);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::Focus(bool focus) {
|
|
|
|
if (focus)
|
|
|
|
window_->Activate();
|
|
|
|
else
|
|
|
|
window_->Deactivate();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::IsFocused() {
|
|
|
|
return window_->IsActive();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::Show() {
|
|
|
|
window_->Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::Hide() {
|
|
|
|
window_->Hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::IsVisible() {
|
|
|
|
return window_->IsVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::Maximize() {
|
|
|
|
window_->Maximize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::Unmaximize() {
|
|
|
|
window_->Restore();
|
|
|
|
}
|
|
|
|
|
2014-07-07 19:49:28 +04:00
|
|
|
bool NativeWindowViews::IsMaximized() {
|
|
|
|
return window_->IsMaximized();
|
|
|
|
}
|
|
|
|
|
2014-07-03 21:30:36 +04:00
|
|
|
void NativeWindowViews::Minimize() {
|
|
|
|
window_->Minimize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::Restore() {
|
|
|
|
window_->Restore();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetFullscreen(bool fullscreen) {
|
|
|
|
window_->SetFullscreen(fullscreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::IsFullscreen() {
|
|
|
|
return window_->IsFullscreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetSize(const gfx::Size& size) {
|
|
|
|
window_->SetSize(size);
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Size NativeWindowViews::GetSize() {
|
|
|
|
return window_->GetWindowBoundsInScreen().size();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetContentSize(const gfx::Size& size) {
|
2014-07-04 08:32:03 +04:00
|
|
|
if (!has_frame_) {
|
|
|
|
SetSize(size);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Rect bounds = window_->GetWindowBoundsInScreen();
|
|
|
|
bounds.set_size(size);
|
2014-07-16 18:10:10 +04:00
|
|
|
window_->SetBounds(ContentBoundsToWindowBounds(bounds));
|
2014-07-03 21:30:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Size NativeWindowViews::GetContentSize() {
|
2014-07-04 08:32:03 +04:00
|
|
|
if (!has_frame_)
|
|
|
|
return GetSize();
|
|
|
|
|
2014-07-16 18:10:10 +04:00
|
|
|
gfx::Size content_size =
|
|
|
|
window_->non_client_view()->frame_view()->GetBoundsForClientView().size();
|
|
|
|
if (menu_bar_)
|
|
|
|
content_size.set_height(content_size.height() - kMenuBarHeight);
|
|
|
|
return content_size;
|
2014-07-03 21:30:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetMinimumSize(const gfx::Size& size) {
|
|
|
|
minimum_size_ = size;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Size NativeWindowViews::GetMinimumSize() {
|
|
|
|
return minimum_size_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetMaximumSize(const gfx::Size& size) {
|
|
|
|
maximum_size_ = size;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Size NativeWindowViews::GetMaximumSize() {
|
|
|
|
return maximum_size_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetResizable(bool resizable) {
|
|
|
|
resizable_ = resizable;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::IsResizable() {
|
|
|
|
return resizable_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetAlwaysOnTop(bool top) {
|
|
|
|
window_->SetAlwaysOnTop(top);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::IsAlwaysOnTop() {
|
2014-07-04 08:32:03 +04:00
|
|
|
return window_->IsAlwaysOnTop();
|
2014-07-03 21:30:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::Center() {
|
|
|
|
window_->CenterWindow(GetSize());
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetPosition(const gfx::Point& position) {
|
|
|
|
window_->SetBounds(gfx::Rect(position, GetSize()));
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Point NativeWindowViews::GetPosition() {
|
|
|
|
return window_->GetWindowBoundsInScreen().origin();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetTitle(const std::string& title) {
|
|
|
|
title_ = title;
|
|
|
|
window_->UpdateWindowTitle();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string NativeWindowViews::GetTitle() {
|
|
|
|
return title_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::FlashFrame(bool flash) {
|
|
|
|
window_->FlashFrame(flash);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetSkipTaskbar(bool skip) {
|
2014-07-07 13:22:22 +04:00
|
|
|
#if defined(OS_WIN)
|
2014-07-03 21:30:36 +04:00
|
|
|
// FIXME
|
2014-07-07 13:22:22 +04:00
|
|
|
#endif
|
2014-07-03 21:30:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::SetKiosk(bool kiosk) {
|
|
|
|
SetFullscreen(kiosk);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::IsKiosk() {
|
|
|
|
return IsFullscreen();
|
|
|
|
}
|
|
|
|
|
2014-07-04 12:54:10 +04:00
|
|
|
void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) {
|
|
|
|
RegisterAccelerators(menu_model);
|
2014-07-11 04:57:19 +04:00
|
|
|
|
|
|
|
#if defined(USE_X11)
|
|
|
|
if (!global_menu_bar_)
|
|
|
|
global_menu_bar_.reset(new GlobalMenuBarX11(this));
|
2014-07-16 18:10:10 +04:00
|
|
|
|
|
|
|
// Use global application menu bar when possible.
|
|
|
|
if (global_menu_bar_->IsServerStarted()) {
|
|
|
|
global_menu_bar_->SetMenu(menu_model);
|
|
|
|
return;
|
|
|
|
}
|
2014-07-11 04:57:19 +04:00
|
|
|
#endif
|
2014-07-16 18:10:10 +04:00
|
|
|
|
|
|
|
// Do not show menu bar in frameless window.
|
|
|
|
if (!has_frame_)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!menu_bar_) {
|
|
|
|
gfx::Size content_size = GetContentSize();
|
|
|
|
menu_bar_ = new MenuBar;
|
|
|
|
AddChildViewAt(menu_bar_, 0);
|
|
|
|
SetContentSize(content_size);
|
|
|
|
}
|
2014-07-04 12:54:10 +04:00
|
|
|
}
|
|
|
|
|
2014-07-03 21:30:36 +04:00
|
|
|
gfx::NativeWindow NativeWindowViews::GetNativeWindow() {
|
|
|
|
return window_->GetNativeWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::UpdateDraggableRegions(
|
|
|
|
const std::vector<DraggableRegion>& regions) {
|
2014-07-07 11:35:16 +04:00
|
|
|
if (has_frame_)
|
|
|
|
return;
|
|
|
|
|
|
|
|
SkRegion* draggable_region = new SkRegion;
|
|
|
|
|
|
|
|
// By default, the whole window is non-draggable. We need to explicitly
|
|
|
|
// include those draggable regions.
|
|
|
|
for (std::vector<DraggableRegion>::const_iterator iter = regions.begin();
|
|
|
|
iter != regions.end(); ++iter) {
|
|
|
|
const DraggableRegion& region = *iter;
|
|
|
|
draggable_region->op(
|
|
|
|
region.bounds.x(),
|
|
|
|
region.bounds.y(),
|
|
|
|
region.bounds.right(),
|
|
|
|
region.bounds.bottom(),
|
|
|
|
region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
|
|
|
|
}
|
|
|
|
|
|
|
|
draggable_region_.reset(draggable_region);
|
2014-07-03 21:30:36 +04:00
|
|
|
}
|
|
|
|
|
2014-07-08 08:55:33 +04:00
|
|
|
void NativeWindowViews::OnWidgetActivationChanged(
|
|
|
|
views::Widget* widget, bool active) {
|
|
|
|
if (widget != window_.get())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (active)
|
|
|
|
NotifyWindowFocus();
|
|
|
|
else
|
|
|
|
NotifyWindowBlur();
|
|
|
|
}
|
|
|
|
|
2014-07-03 21:30:36 +04:00
|
|
|
void NativeWindowViews::DeleteDelegate() {
|
|
|
|
NotifyWindowClosed();
|
|
|
|
}
|
|
|
|
|
|
|
|
views::View* NativeWindowViews::GetInitiallyFocusedView() {
|
2014-07-04 12:54:10 +04:00
|
|
|
return inspectable_web_contents()->GetView()->GetWebView();
|
2014-07-03 21:30:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::CanResize() const {
|
|
|
|
return resizable_;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::CanMaximize() const {
|
|
|
|
return resizable_;
|
|
|
|
}
|
|
|
|
|
|
|
|
base::string16 NativeWindowViews::GetWindowTitle() const {
|
|
|
|
return base::UTF8ToUTF16(title_);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::ShouldHandleSystemCommands() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::ImageSkia NativeWindowViews::GetWindowAppIcon() {
|
|
|
|
if (icon_)
|
|
|
|
return *(icon_->ToImageSkia());
|
|
|
|
else
|
|
|
|
return gfx::ImageSkia();
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::ImageSkia NativeWindowViews::GetWindowIcon() {
|
|
|
|
return GetWindowAppIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
views::Widget* NativeWindowViews::GetWidget() {
|
|
|
|
return window_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
const views::Widget* NativeWindowViews::GetWidget() const {
|
|
|
|
return window_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
views::View* NativeWindowViews::GetContentsView() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2014-07-07 11:35:16 +04:00
|
|
|
bool NativeWindowViews::ShouldDescendIntoChildForEventHandling(
|
|
|
|
gfx::NativeView child,
|
|
|
|
const gfx::Point& location) {
|
|
|
|
// App window should claim mouse events that fall within the draggable region.
|
2014-07-16 11:33:40 +04:00
|
|
|
if (draggable_region_ &&
|
2014-07-07 18:39:39 +04:00
|
|
|
draggable_region_->contains(location.x(), location.y()))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// And the events on border for dragging resizable frameless window.
|
|
|
|
if (!has_frame_ && CanResize()) {
|
2014-07-16 11:33:40 +04:00
|
|
|
FramelessView* frame = static_cast<FramelessView*>(
|
2014-07-07 18:39:39 +04:00
|
|
|
window_->non_client_view()->frame_view());
|
|
|
|
return frame->ResizingBorderHitTest(location) == HTNOWHERE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2014-07-07 11:35:16 +04:00
|
|
|
}
|
|
|
|
|
2014-07-03 21:30:36 +04:00
|
|
|
views::ClientView* NativeWindowViews::CreateClientView(views::Widget* widget) {
|
|
|
|
return new NativeWindowClientView(widget, this);
|
|
|
|
}
|
|
|
|
|
2014-07-04 08:32:03 +04:00
|
|
|
views::NonClientFrameView* NativeWindowViews::CreateNonClientFrameView(
|
|
|
|
views::Widget* widget) {
|
2014-07-07 11:35:16 +04:00
|
|
|
#if defined(USE_X11)
|
|
|
|
LinuxFrameView* frame_view = new LinuxFrameView;
|
2014-07-16 12:00:08 +04:00
|
|
|
#else
|
2014-07-16 11:33:40 +04:00
|
|
|
WinFrameView* frame_view = new WinFrameView;
|
|
|
|
#endif
|
2014-07-07 11:35:16 +04:00
|
|
|
frame_view->Init(this, widget);
|
2014-07-12 07:36:08 +04:00
|
|
|
return frame_view;
|
2014-07-04 08:32:03 +04:00
|
|
|
}
|
|
|
|
|
2014-07-04 12:54:10 +04:00
|
|
|
void NativeWindowViews::HandleKeyboardEvent(
|
|
|
|
content::WebContents*,
|
|
|
|
const content::NativeWebKeyboardEvent& event) {
|
2014-07-07 19:02:46 +04:00
|
|
|
keyboard_event_handler_->HandleKeyboardEvent(event, GetFocusManager());
|
2014-07-04 12:54:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWindowViews::AcceleratorPressed(const ui::Accelerator& accelerator) {
|
|
|
|
return accelerator_util::TriggerAcceleratorTableCommand(
|
|
|
|
&accelerator_table_, accelerator);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NativeWindowViews::RegisterAccelerators(ui::MenuModel* menu_model) {
|
|
|
|
// Clear previous accelerators.
|
|
|
|
views::FocusManager* focus_manager = GetFocusManager();
|
|
|
|
accelerator_table_.clear();
|
|
|
|
focus_manager->UnregisterAccelerators(this);
|
|
|
|
|
|
|
|
// Register accelerators with focus manager.
|
|
|
|
accelerator_util::GenerateAcceleratorTable(&accelerator_table_, menu_model);
|
|
|
|
accelerator_util::AcceleratorTable::const_iterator iter;
|
|
|
|
for (iter = accelerator_table_.begin();
|
|
|
|
iter != accelerator_table_.end();
|
|
|
|
++iter) {
|
|
|
|
focus_manager->RegisterAccelerator(
|
|
|
|
iter->first, ui::AcceleratorManager::kNormalPriority, this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-16 18:10:10 +04:00
|
|
|
gfx::Rect NativeWindowViews::ContentBoundsToWindowBounds(
|
|
|
|
const gfx::Rect& bounds) {
|
|
|
|
gfx::Rect window_bounds =
|
|
|
|
window_->non_client_view()->GetWindowBoundsForClientBounds(bounds);
|
|
|
|
if (menu_bar_)
|
|
|
|
window_bounds.set_height(window_bounds.height() + kMenuBarHeight);
|
|
|
|
return window_bounds;
|
|
|
|
}
|
|
|
|
|
2014-07-03 21:30:36 +04:00
|
|
|
// static
|
|
|
|
NativeWindow* NativeWindow::Create(content::WebContents* web_contents,
|
|
|
|
const mate::Dictionary& options) {
|
|
|
|
return new NativeWindowViews(web_contents, options);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace atom
|