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

Unified Diff: chrome/browser/ui/views/extensions/native_app_window_views.cc

Issue 14031021: Save and restore State for ShellWindows, including panels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months 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: chrome/browser/ui/views/extensions/native_app_window_views.cc
diff --git a/chrome/browser/ui/views/extensions/native_app_window_views.cc b/chrome/browser/ui/views/extensions/native_app_window_views.cc
index 8565bc6ad0f51976d272911e1aa7f54bdff9b378..3c1abbddd4dc4f413446a6b965dd907ba9bc704a 100644
--- a/chrome/browser/ui/views/extensions/native_app_window_views.cc
+++ b/chrome/browser/ui/views/extensions/native_app_window_views.cc
@@ -41,6 +41,7 @@
#include "ash/wm/window_properties.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
#endif
namespace {
@@ -266,15 +267,22 @@ void NativeAppWindowViews::InitializePanelWindow(
window_->Init(params);
window_->set_focus_on_creation(create_params.focused);
-#if !defined(USE_ASH)
- // TODO(oshima|stevenjb): Ideally, we should be able to just pre-determine
- // the exact location and size, but this doesn't work well
- // on non-ash environment where we don't have full control over
- // window management.
- gfx::Rect window_bounds =
- window_->non_client_view()->GetWindowBoundsForClientBounds(
- create_params.bounds);
- window_->SetBounds(window_bounds);
flackr 2013/04/26 03:44:38 You seem to be removing restoring bounds for non a
stevenjb 2013/04/26 16:12:17 As I commented, this is not implemented for non-as
+#if defined(USE_ASH)
+ if (create_params.state == ui::SHOW_STATE_DETACHED) {
+ gfx::Rect window_bounds(create_params.bounds.x(),
+ create_params.bounds.y(),
+ preferred_size_.width(),
+ preferred_size_.height());
+ aura::Window* win = GetNativeWindow();
+ win->SetProperty(ash::internal::kPanelAttachedKey, false);
+ win->SetDefaultParentByRootWindow(
+ win->GetRootWindow(),
+ win->GetBoundsInScreen());
+ window_->SetBounds(window_bounds);
+ }
+#else
+ // TODO(stevenjb): NativeAppWindow panels need to be implemented for other
+ // platforms.
#endif
}
@@ -665,6 +673,17 @@ bool NativeAppWindowViews::IsFullscreenOrPending() const {
return is_fullscreen_;
}
+bool NativeAppWindowViews::IsDetached() const {
+ if (!shell_window_->window_type_is_panel())
+ return false;
+#if defined(USE_ASH)
+ return !window_->GetNativeWindow()->GetProperty(
+ ash::internal::kPanelAttachedKey);
+#else
+ return false;
+#endif
+}
+
views::View* NativeAppWindowViews::GetContentsView() {
return this;
}

Powered by Google App Engine
This is Rietveld 408576698