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

Unified Diff: ui/aura/test/test_activation_client.cc

Issue 9702054: Revert 126764 - Added notion of currently active app / browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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/aura/test/test_activation_client.h ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/test_activation_client.cc
===================================================================
--- ui/aura/test/test_activation_client.cc (revision 126791)
+++ ui/aura/test/test_activation_client.cc (working copy)
@@ -4,7 +4,6 @@
#include "ui/aura/test/test_activation_client.h"
-#include "ui/aura/client/activation_delegate.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -14,44 +13,34 @@
////////////////////////////////////////////////////////////////////////////////
// TestActivationClient, public:
-TestActivationClient::TestActivationClient(RootWindow* root_window) {
+TestActivationClient::TestActivationClient(RootWindow* root_window)
+ : active_window_(NULL) {
client::SetActivationClient(root_window, this);
}
TestActivationClient::~TestActivationClient() {
- for (unsigned int i = 0; i < active_windows_.size(); ++i) {
- active_windows_[i]->RemoveObserver(this);
- }
}
////////////////////////////////////////////////////////////////////////////////
// TestActivationClient, client::ActivationClient implementation:
void TestActivationClient::ActivateWindow(Window* window) {
- Window *last_active = GetActiveWindow();
- if (last_active == window)
- return;
-
- RemoveActiveWindow(window);
- active_windows_.push_back(window);
- window->AddObserver(this);
- if (aura::client::GetActivationDelegate(window))
- aura::client::GetActivationDelegate(window)->OnActivated();
-
- if (last_active && aura::client::GetActivationDelegate(last_active))
- aura::client::GetActivationDelegate(last_active)->OnLostActive();
-
+ if (active_window_)
+ active_window_->RemoveObserver(this);
+ active_window_ = window;
+ active_window_->AddObserver(this);
}
void TestActivationClient::DeactivateWindow(Window* window) {
- if (aura::client::GetActivationDelegate(window))
- aura::client::GetActivationDelegate(window)->OnLostActive();
+ if (window == active_window_) {
+ if (active_window_)
+ active_window_->RemoveObserver(this);
+ active_window_ = NULL;
+ }
}
Window* TestActivationClient::GetActiveWindow() {
- if (active_windows_.empty())
- return NULL;
- return active_windows_.back();
+ return active_window_;
}
bool TestActivationClient::CanFocusWindow(Window* window) const {
@@ -62,27 +51,11 @@
// TestActivationClient, WindowObserver implementation:
void TestActivationClient::OnWindowDestroyed(Window* window) {
- if (window == GetActiveWindow()) {
+ if (window == active_window_) {
window->RemoveObserver(this);
- active_windows_.pop_back();
- Window* next_active = GetActiveWindow();
- if (next_active && aura::client::GetActivationDelegate(next_active))
- aura::client::GetActivationDelegate(next_active)->OnActivated();
- return;
+ active_window_ = NULL;
}
-
- RemoveActiveWindow(window);
}
-void TestActivationClient::RemoveActiveWindow(Window* window) {
- for (unsigned int i = 0; i < active_windows_.size(); ++i) {
- if (active_windows_[i] == window) {
- active_windows_.erase(active_windows_.begin() + i);
- window->RemoveObserver(this);
- return;
- }
- }
-}
-
} // namespace test
} // namespace aura
« no previous file with comments | « ui/aura/test/test_activation_client.h ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698