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

Unified Diff: ui/aura/client/default_activation_client.cc

Issue 250113002: Move DefaultActivationClient to wm/core (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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/aura/client/default_activation_client.h ('k') | ui/aura/test/aura_test_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/client/default_activation_client.cc
diff --git a/ui/aura/client/default_activation_client.cc b/ui/aura/client/default_activation_client.cc
deleted file mode 100644
index d8fdf8b01bac79150ce0d89a972630faa752beb6..0000000000000000000000000000000000000000
--- a/ui/aura/client/default_activation_client.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/aura/client/default_activation_client.h"
-
-#include "ui/aura/window.h"
-#include "ui/wm/public/activation_change_observer.h"
-#include "ui/wm/public/activation_delegate.h"
-
-namespace aura {
-namespace client {
-
-////////////////////////////////////////////////////////////////////////////////
-// DefaultActivationClient, public:
-
-DefaultActivationClient::DefaultActivationClient(Window* root_window)
- : last_active_(NULL) {
- client::SetActivationClient(root_window, this);
-}
-
-DefaultActivationClient::~DefaultActivationClient() {
- for (unsigned int i = 0; i < active_windows_.size(); ++i) {
- active_windows_[i]->RemoveObserver(this);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// DefaultActivationClient, client::ActivationClient implementation:
-
-void DefaultActivationClient::AddObserver(
- client::ActivationChangeObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void DefaultActivationClient::RemoveObserver(
- client::ActivationChangeObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-void DefaultActivationClient::ActivateWindow(Window* window) {
- Window* last_active = GetActiveWindow();
- if (last_active == window)
- return;
-
- last_active_ = last_active;
- RemoveActiveWindow(window);
- active_windows_.push_back(window);
- window->parent()->StackChildAtTop(window);
- window->AddObserver(this);
-
- FOR_EACH_OBSERVER(client::ActivationChangeObserver,
- observers_,
- OnWindowActivated(window, last_active));
-
- aura::client::ActivationChangeObserver* observer =
- aura::client::GetActivationChangeObserver(last_active);
- if (observer)
- observer->OnWindowActivated(window, last_active);
- observer = aura::client::GetActivationChangeObserver(window);
- if (observer)
- observer->OnWindowActivated(window, last_active);
-}
-
-void DefaultActivationClient::DeactivateWindow(Window* window) {
- aura::client::ActivationChangeObserver* observer =
- aura::client::GetActivationChangeObserver(window);
- if (observer)
- observer->OnWindowActivated(NULL, window);
- if (last_active_)
- ActivateWindow(last_active_);
-}
-
-Window* DefaultActivationClient::GetActiveWindow() {
- if (active_windows_.empty())
- return NULL;
- return active_windows_.back();
-}
-
-Window* DefaultActivationClient::GetActivatableWindow(Window* window) {
- return NULL;
-}
-
-Window* DefaultActivationClient::GetToplevelWindow(Window* window) {
- return NULL;
-}
-
-bool DefaultActivationClient::OnWillFocusWindow(Window* window,
- const ui::Event* event) {
- return true;
-}
-
-bool DefaultActivationClient::CanActivateWindow(Window* window) const {
- return true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// DefaultActivationClient, WindowObserver implementation:
-
-void DefaultActivationClient::OnWindowDestroyed(Window* window) {
- if (window == last_active_)
- last_active_ = NULL;
-
- if (window == GetActiveWindow()) {
- active_windows_.pop_back();
- Window* next_active = GetActiveWindow();
- if (next_active && aura::client::GetActivationChangeObserver(next_active)) {
- aura::client::GetActivationChangeObserver(next_active)->OnWindowActivated(
- next_active, NULL);
- }
- return;
- }
-
- RemoveActiveWindow(window);
-}
-
-void DefaultActivationClient::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 client
-} // namespace aura
« no previous file with comments | « ui/aura/client/default_activation_client.h ('k') | ui/aura/test/aura_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698