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

Unified Diff: ui/views/widget/native_widget_aura.cc

Issue 10081022: Aura/ash split: Remove hacks and get chrome linking without ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move the check to ash/. Created 8 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
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_helper_aura.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura.cc
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 9de1e78968b415a06c6e9a71023fc9fb87d37e28..bb97eca1399414f07d395ae2f8d591d21d44c987 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -9,13 +9,9 @@
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/client/dispatcher_client.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/window_move_client.h"
#include "ui/aura/client/window_types.h"
-#include "ui/aura/desktop/desktop_activation_client.h"
-#include "ui/aura/desktop/desktop_dispatcher_client.h"
-#include "ui/aura/desktop/desktop_root_window_event_filter.h"
#include "ui/aura/env.h"
#include "ui/aura/event.h"
#include "ui/aura/root_window.h"
@@ -29,8 +25,10 @@
#include "ui/gfx/screen.h"
#include "ui/views/drag_utils.h"
#include "ui/views/ime/input_method_bridge.h"
+#include "ui/views/views_delegate.h"
#include "ui/views/widget/drop_helper.h"
#include "ui/views/widget/native_widget_delegate.h"
+#include "ui/views/widget/native_widget_helper_aura.h"
#include "ui/views/widget/root_view.h"
#include "ui/views/widget/tooltip_manager_aura.h"
#include "ui/views/widget/widget_delegate.h"
@@ -48,8 +46,6 @@
namespace views {
-bool NativeWidgetAura::g_aura_desktop_hax = false;
-
namespace {
aura::client::WindowType GetAuraWindowTypeForWidgetType(
@@ -139,7 +135,10 @@ class NativeWidgetAura::ActiveWindowObserver : public aura::WindowObserver {
NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate)
: delegate_(delegate),
- root_window_(NULL),
+ ALLOW_THIS_IN_INITIALIZER_LIST(desktop_helper_(
+ ViewsDelegate::views_delegate ?
+ ViewsDelegate::views_delegate->CreateNativeWidgetHelper(this) :
+ NULL)),
ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))),
ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)),
@@ -173,25 +172,9 @@ gfx::Font NativeWidgetAura::GetWindowTitleFont() {
void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
ownership_ = params.ownership;
- // TODO(erg): What kind of windows do we want to have their own root windows?
- if (g_aura_desktop_hax) {
- gfx::Rect bounds = params.bounds;
- if (bounds.IsEmpty()) {
- // We must pass some non-zero value when we initialize a RootWindow. This
- // will probably be SetBounds()ed soon.
- bounds.set_size(gfx::Size(100, 100));
- }
- root_window_.reset(new aura::RootWindow(bounds));
- root_window_->SetEventFilter(
- new aura::DesktopRootWindowEventFilter(root_window_.get()));
- root_window_->AddRootWindowObserver(this);
-
- aura::client::SetActivationClient(
- root_window_.get(),
- new aura::DesktopActivationClient(root_window_.get()));
- aura::client::SetDispatcherClient(root_window_.get(),
- new aura::DesktopDispatcherClient);
- }
+
+ if (desktop_helper_.get())
+ desktop_helper_->PreInitialize(params);
window_->set_user_data(this);
window_->SetType(GetAuraWindowTypeForWidgetType(params.type));
@@ -204,8 +187,8 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
window_->Show();
delegate_->OnNativeWidgetCreated();
- if (root_window_.get()) {
- window_->SetParent(root_window_.get());
+ if (desktop_helper_.get() && desktop_helper_->GetRootWindow()) {
+ window_->SetParent(desktop_helper_->GetRootWindow());
} else if (params.child) {
window_->SetParent(params.GetParent());
} else {
@@ -220,7 +203,7 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
// client per root window instead. For now, we hax our way around this by
// forcing the parent to be the root window instead of passing NULL as
// the parent which will dispatch to the stacking client.
- if (g_aura_desktop_hax)
+ if (desktop_helper_.get())
parent = parent->GetRootWindow();
else
parent = NULL;
@@ -253,8 +236,9 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
aura::client::SetActivationDelegate(window_, this);
- if (root_window_.get())
- root_window_->ShowRootWindow();
+ // TODO(erg): Move this somewhere else?
+ if (desktop_helper_.get())
+ desktop_helper_->ShowRootWindow();
}
NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() {
@@ -471,11 +455,8 @@ gfx::Rect NativeWidgetAura::GetRestoredBounds() const {
void NativeWidgetAura::SetBounds(const gfx::Rect& in_bounds) {
gfx::Rect bounds = in_bounds;
- if (root_window_.get() && !bounds.IsEmpty()) {
- root_window_->SetHostBounds(bounds);
- bounds.set_x(0);
- bounds.set_y(0);
- }
+ if (desktop_helper_.get())
+ bounds = desktop_helper_->ModifyAndSetBounds(bounds);
#if defined(ENABLE_DIP)
bounds = ConvertRectToMonitor(bounds);
#endif
@@ -873,23 +854,6 @@ void NativeWidgetAura::OnWindowVisibilityChanged(bool visible) {
}
////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetAura, aura::RootWindowObserver implementation:
-
-void NativeWidgetAura::OnRootWindowResized(const aura::RootWindow* root,
- const gfx::Size& old_size) {
- // This case can only happen if we have our own aura::RootWindow*. When that
- // happens, our main window should be at the origin and sized to the
- // RootWindow.
- DCHECK_EQ(root, root_window_.get());
- SetBounds(gfx::Rect(root->GetHostSize()));
-}
-
-void NativeWidgetAura::OnRootWindowHostClosed(const aura::RootWindow* root) {
- DCHECK_EQ(root, root_window_.get());
- GetWidget()->Close();
-}
-
-////////////////////////////////////////////////////////////////////////////////
// NativeWidgetAura, aura::ActivationDelegate implementation:
bool NativeWidgetAura::ShouldActivate(const aura::Event* event) {
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_helper_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698