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

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

Issue 8926004: Revert 114095 - Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura.cc
===================================================================
--- ui/views/widget/native_widget_aura.cc (revision 114099)
+++ ui/views/widget/native_widget_aura.cc (working copy)
@@ -6,14 +6,13 @@
#include "base/bind.h"
#include "base/string_util.h"
-#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/shadow_types.h"
#include "ui/aura/event.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/root_window_observer.h"
#include "ui/aura/window.h"
-#include "ui/aura/window_observer.h"
#include "ui/aura/window_types.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/ui_base_types.h"
@@ -77,23 +76,20 @@
// Used when SetInactiveRenderingDisabled() is invoked to track when active
// status changes in such a way that we should enable inactive rendering.
-class NativeWidgetAura::ActiveWindowObserver : public aura::WindowObserver {
+class NativeWidgetAura::RootWindowObserverImpl
+ : public aura::RootWindowObserver {
public:
- explicit ActiveWindowObserver(NativeWidgetAura* host) : host_(host) {
+ explicit RootWindowObserverImpl(NativeWidgetAura* host)
+ : host_(host) {
aura::RootWindow::GetInstance()->AddObserver(this);
}
- virtual ~ActiveWindowObserver() {
+
+ virtual ~RootWindowObserverImpl() {
aura::RootWindow::GetInstance()->RemoveObserver(this);
}
- // Overridden from aura::WindowObserver:
- virtual void OnWindowPropertyChanged(aura::Window* window,
- const char* key,
- void* old) OVERRIDE {
- if (key != aura::kRootWindowActiveWindow)
- return;
- aura::Window* active =
- aura::ActivationClient::GetActivationClient()->GetActiveWindow();
+ // RootWindowObserver overrides:
+ virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE {
if (!active || (active != host_->window_ &&
active->transient_parent() != host_->window_)) {
host_->delegate_->EnableInactiveRendering();
@@ -103,7 +99,7 @@
private:
NativeWidgetAura* host_;
- DISALLOW_COPY_AND_ASSIGN(ActiveWindowObserver);
+ DISALLOW_COPY_AND_ASSIGN(RootWindowObserverImpl);
};
////////////////////////////////////////////////////////////////////////////////
@@ -185,8 +181,6 @@
static_cast<aura::WindowDragDropDelegate*>(this));
}
- aura::ActivationDelegate::SetActivationDelegate(window_, this);
-
if (window_type == Widget::InitParams::TYPE_MENU ||
window_type == Widget::InitParams::TYPE_TOOLTIP)
window_->SetIntProperty(aura::kShadowTypeKey,
@@ -431,7 +425,7 @@
window_->Show();
if (can_activate_ && (state != ui::SHOW_STATE_INACTIVE ||
!GetWidget()->SetInitialFocus())) {
- Activate();
+ window_->Activate();
}
}
@@ -440,16 +434,15 @@
}
void NativeWidgetAura::Activate() {
- aura::ActivationClient::GetActivationClient()->ActivateWindow(window_);
+ window_->Activate();
}
void NativeWidgetAura::Deactivate() {
- aura::ActivationClient::GetActivationClient()->DeactivateWindow(window_);
+ window_->Deactivate();
}
bool NativeWidgetAura::IsActive() const {
- return aura::ActivationClient::GetActivationClient()->GetActiveWindow() ==
- window_;
+ return aura::RootWindow::GetInstance()->active_window() == window_;
}
void NativeWidgetAura::SetAlwaysOnTop(bool on_top) {
@@ -539,9 +532,9 @@
void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) {
if (!value)
- active_window_observer_.reset();
+ root_window_observer_.reset();
else
- active_window_observer_.reset(new ActiveWindowObserver(this));
+ root_window_observer_.reset(new RootWindowObserverImpl(this));
}
////////////////////////////////////////////////////////////////////////////////
@@ -636,6 +629,22 @@
return true;
}
+bool NativeWidgetAura::ShouldActivate(aura::Event* event) {
+ return can_activate_;
+}
+
+void NativeWidgetAura::OnActivated() {
+ delegate_->OnNativeWidgetActivationChanged(true);
+ if (IsVisible() && GetWidget()->non_client_view())
+ GetWidget()->non_client_view()->SchedulePaint();
+}
+
+void NativeWidgetAura::OnLostActive() {
+ delegate_->OnNativeWidgetActivationChanged(false);
+ if (IsVisible() && GetWidget()->non_client_view())
+ GetWidget()->non_client_view()->SchedulePaint();
+}
+
void NativeWidgetAura::OnCaptureLost() {
delegate_->OnMouseCaptureLost();
}
@@ -664,28 +673,6 @@
delegate_->OnNativeWidgetVisibilityChanged(visible);
}
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetAura, aura::ActivationDelegate implementation:
-
-bool NativeWidgetAura::ShouldActivate(aura::Event* event) {
- return can_activate_;
-}
-
-void NativeWidgetAura::OnActivated() {
- delegate_->OnNativeWidgetActivationChanged(true);
- if (IsVisible() && GetWidget()->non_client_view())
- GetWidget()->non_client_view()->SchedulePaint();
-}
-
-void NativeWidgetAura::OnLostActive() {
- delegate_->OnNativeWidgetActivationChanged(false);
- if (IsVisible() && GetWidget()->non_client_view())
- GetWidget()->non_client_view()->SchedulePaint();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWidgetAura, aura::WindowDragDropDelegate implementation:
-
void NativeWidgetAura::OnDragEntered(const aura::DropTargetEvent& event) {
DCHECK(drop_helper_.get() != NULL);
drop_helper_->OnDragOver(event.data(), event.location(),
Property changes on: ui\views\widget\native_widget_aura.cc
___________________________________________________________________
Added: svn:mergeinfo
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698