Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: extensions/shell/browser/shell_native_app_window.cc

Issue 696063008: Refactor ShellDesktopController and ShellNativeAppWindow to allow for non-aura implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: + Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/shell/browser/shell_native_app_window.cc
diff --git a/extensions/shell/browser/shell_native_app_window.cc b/extensions/shell/browser/shell_native_app_window.cc
index 0f3d29fb2d59bf5639daaacb235890ca86bc4e48..dd8bfa0bacfa5734e46829501cf86b7d7244df98 100644
--- a/extensions/shell/browser/shell_native_app_window.cc
+++ b/extensions/shell/browser/shell_native_app_window.cc
@@ -4,48 +4,24 @@
#include "extensions/shell/browser/shell_native_app_window.h"
-#include "content/public/browser/web_contents.h"
#include "extensions/shell/browser/desktop_controller.h"
-#include "ui/aura/window.h"
-#include "ui/aura/window_tree_host.h"
+#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
-#include "ui/wm/core/window_util.h"
namespace extensions {
-namespace {
-
-gfx::Size GetDesktopWindowSize() {
- return DesktopController::instance()->GetHost()->window()->bounds().size();
-}
-
-} // namespace
ShellNativeAppWindow::ShellNativeAppWindow(
AppWindow* app_window,
const AppWindow::CreateParams& params)
: app_window_(app_window) {
- gfx::Rect bounds = params.GetInitialWindowBounds(GetFrameInsets());
- bool position_specified =
- bounds.x() != AppWindow::BoundsSpecification::kUnspecifiedPosition &&
- bounds.y() != AppWindow::BoundsSpecification::kUnspecifiedPosition;
- if (!position_specified)
- bounds.set_origin(GetBounds().origin());
- SetBounds(bounds);
}
ShellNativeAppWindow::~ShellNativeAppWindow() {
}
-bool ShellNativeAppWindow::IsActive() const {
- // Even though app_shell only supports a single app window, there might be
- // some sort of system-level dialog open and active.
- aura::Window* window = GetWindow();
- return window && wm::IsActiveWindow(window);
-}
-
bool ShellNativeAppWindow::IsMaximized() const {
return false;
}
@@ -61,10 +37,6 @@ bool ShellNativeAppWindow::IsFullscreen() const {
return false;
}
-gfx::NativeWindow ShellNativeAppWindow::GetNativeWindow() const {
- return GetWindow();
-}
-
gfx::Rect ShellNativeAppWindow::GetRestoredBounds() const {
// app_shell windows cannot be maximized, so the current bounds are the
// restored bounds.
@@ -75,18 +47,6 @@ ui::WindowShowState ShellNativeAppWindow::GetRestoredState() const {
return ui::SHOW_STATE_NORMAL;
}
-gfx::Rect ShellNativeAppWindow::GetBounds() const {
- return GetWindow()->GetBoundsInScreen();
-}
-
-void ShellNativeAppWindow::Show() {
- GetWindow()->Show();
-}
-
-void ShellNativeAppWindow::Hide() {
- GetWindow()->Hide();
-}
-
void ShellNativeAppWindow::ShowInactive() {
NOTIMPLEMENTED();
}
@@ -96,18 +56,6 @@ void ShellNativeAppWindow::Close() {
app_window_->OnNativeClose();
}
-void ShellNativeAppWindow::Activate() {
- aura::Window* window = GetWindow();
- if (window)
- wm::ActivateWindow(window);
-}
-
-void ShellNativeAppWindow::Deactivate() {
- aura::Window* window = GetWindow();
- if (window)
- wm::DeactivateWindow(window);
-}
-
void ShellNativeAppWindow::Maximize() {
NOTIMPLEMENTED();
}
@@ -120,10 +68,6 @@ void ShellNativeAppWindow::Restore() {
NOTIMPLEMENTED();
}
-void ShellNativeAppWindow::SetBounds(const gfx::Rect& bounds) {
- GetWindow()->SetBounds(bounds);
-}
-
void ShellNativeAppWindow::FlashFrame(bool flash) {
NOTIMPLEMENTED();
}
@@ -236,12 +180,12 @@ void ShellNativeAppWindow::UpdateShelfMenu() {
gfx::Size ShellNativeAppWindow::GetContentMinimumSize() const {
// Content fills the desktop and cannot be resized.
- return GetDesktopWindowSize();
+ return DesktopController::instance()->GetWindowSize();
}
gfx::Size ShellNativeAppWindow::GetContentMaximumSize() const {
// Content fills the desktop and cannot be resized.
- return GetDesktopWindowSize();
+ return DesktopController::instance()->GetWindowSize();
}
void ShellNativeAppWindow::SetContentSizeConstraints(
@@ -259,8 +203,4 @@ bool ShellNativeAppWindow::CanHaveAlphaEnabled() const {
return false;
}
-aura::Window* ShellNativeAppWindow::GetWindow() const {
- return app_window_->web_contents()->GetNativeView();
-}
-
} // namespace extensions
« no previous file with comments | « extensions/shell/browser/shell_native_app_window.h ('k') | extensions/shell/browser/shell_native_app_window_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698