Index: components/native_app_window/native_app_window_views.cc |
diff --git a/components/native_app_window/native_app_window_views.cc b/components/native_app_window/native_app_window_views.cc |
index fb9168210365db4454b1628eaa9a1e91f67b6eab..ffcf872a38577a5e54fddbc3c06b914ba5f5ffc5 100644 |
--- a/components/native_app_window/native_app_window_views.cc |
+++ b/components/native_app_window/native_app_window_views.cc |
@@ -5,11 +5,11 @@ |
#include "components/native_app_window/native_app_window_views.h" |
#include "base/threading/sequenced_worker_pool.h" |
+#include "components/native_app_window/app_window_create_params.h" |
+#include "components/native_app_window/draggable_region.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/render_widget_host_view.h" |
#include "content/public/browser/web_contents.h" |
-#include "extensions/browser/app_window/app_window.h" |
-#include "extensions/common/draggable_region.h" |
#include "third_party/skia/include/core/SkRegion.h" |
#include "ui/gfx/path.h" |
#include "ui/views/controls/webview/webview.h" |
@@ -20,8 +20,6 @@ |
#include "ui/aura/window.h" |
#endif |
-using extensions::AppWindow; |
- |
namespace native_app_window { |
NativeAppWindowViews::NativeAppWindowViews() |
@@ -32,16 +30,16 @@ NativeAppWindowViews::NativeAppWindowViews() |
resizable_(false) { |
} |
-void NativeAppWindowViews::Init(AppWindow* app_window, |
- const AppWindow::CreateParams& create_params) { |
+void NativeAppWindowViews::Init(NativeAppWindowDelegate* app_window, |
+ const AppWindowCreateParams& create_params) { |
app_window_ = app_window; |
- frameless_ = create_params.frame == AppWindow::FRAME_NONE; |
+ frameless_ = create_params.frame == native_app_window::FRAME_NONE; |
resizable_ = create_params.resizable; |
size_constraints_.set_minimum_size( |
create_params.GetContentMinimumSize(gfx::Insets())); |
size_constraints_.set_maximum_size( |
create_params.GetContentMaximumSize(gfx::Insets())); |
- Observe(app_window_->web_contents()); |
+ Observe(app_window_->GetWebContents()); |
widget_ = new views::Widget; |
InitializeWindow(app_window, create_params); |
@@ -59,8 +57,8 @@ void NativeAppWindowViews::OnCanHaveAlphaEnabledChanged() { |
} |
void NativeAppWindowViews::InitializeWindow( |
- AppWindow* app_window, |
- const AppWindow::CreateParams& create_params) { |
+ NativeAppWindowDelegate* app_window, |
+ const AppWindowCreateParams& create_params) { |
// Stub implementation. See also ChromeNativeAppWindowViews. |
views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW); |
init_params.delegate = this; |
@@ -215,7 +213,7 @@ bool NativeAppWindowViews::CanResize() const { |
bool NativeAppWindowViews::CanMaximize() const { |
return resizable_ && !size_constraints_.HasMaximumSize() && |
- !app_window_->window_type_is_panel() && !WidgetHasHitTestMask(); |
+ !app_window_->WindowTypeIsPanel() && !WidgetHasHitTestMask(); |
} |
bool NativeAppWindowViews::CanMinimize() const { |
@@ -227,11 +225,13 @@ base::string16 NativeAppWindowViews::GetWindowTitle() const { |
} |
bool NativeAppWindowViews::ShouldShowWindowTitle() const { |
- return app_window_->window_type() == AppWindow::WINDOW_TYPE_V1_PANEL; |
+ return app_window_->GetWindowType() == |
+ native_app_window::WINDOW_TYPE_V1_PANEL; |
} |
bool NativeAppWindowViews::ShouldShowWindowIcon() const { |
- return app_window_->window_type() == AppWindow::WINDOW_TYPE_V1_PANEL; |
+ return app_window_->GetWindowType() == |
+ native_app_window::WINDOW_TYPE_V1_PANEL; |
} |
void NativeAppWindowViews::SaveWindowPlacement(const gfx::Rect& bounds, |
@@ -261,7 +261,7 @@ bool NativeAppWindowViews::ShouldDescendIntoChildForEventHandling( |
gfx::NativeView child, |
const gfx::Point& location) { |
#if defined(USE_AURA) |
- if (child->Contains(web_view_->web_contents()->GetNativeView())) { |
+ if (child->Contains(web_view_->GetWebContents()->GetNativeView())) { |
// App window should claim mouse events that fall within the draggable |
// region. |
return !draggable_region_.get() || |
@@ -290,7 +290,7 @@ void NativeAppWindowViews::OnWidgetActivationChanged(views::Widget* widget, |
void NativeAppWindowViews::RenderViewCreated( |
content::RenderViewHost* render_view_host) { |
- if (app_window_->requested_alpha_enabled() && CanHaveAlphaEnabled()) { |
+ if (app_window_->RequestedAlphaEnabled() && CanHaveAlphaEnabled()) { |
content::RenderWidgetHostView* view = render_view_host->GetView(); |
DCHECK(view); |
view->SetBackgroundOpaque(false); |
@@ -316,7 +316,7 @@ void NativeAppWindowViews::ViewHierarchyChanged( |
if (details.is_add && details.child == this) { |
web_view_ = new views::WebView(NULL); |
AddChildView(web_view_); |
- web_view_->SetWebContents(app_window_->web_contents()); |
+ web_view_->SetWebContents(app_window_->GetWebContents()); |
} |
} |
@@ -336,7 +336,8 @@ void NativeAppWindowViews::OnFocus() { |
void NativeAppWindowViews::SetFullscreen(int fullscreen_types) { |
// Stub implementation. See also ChromeNativeAppWindowViews. |
- widget_->SetFullscreen(fullscreen_types != AppWindow::FULLSCREEN_TYPE_NONE); |
+ widget_->SetFullscreen(fullscreen_types != |
+ native_app_window::FULLSCREEN_TYPE_NONE); |
} |
bool NativeAppWindowViews::IsFullscreenOrPending() const { |
@@ -357,12 +358,12 @@ void NativeAppWindowViews::UpdateBadgeIcon() { |
} |
void NativeAppWindowViews::UpdateDraggableRegions( |
- const std::vector<extensions::DraggableRegion>& regions) { |
+ const std::vector<native_app_window::DraggableRegion>& regions) { |
// Draggable region is not supported for non-frameless window. |
if (!frameless_) |
return; |
- draggable_region_.reset(AppWindow::RawDraggableRegionsToSkRegion(regions)); |
+ draggable_region_.reset(RawDraggableRegionsToSkRegion(regions)); |
OnViewWasResized(); |
} |