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

Unified Diff: ash/display/display_controller.cc

Issue 14807002: Revert 197501 "Merge 195552 "Restore focus/activation after the ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1453/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
« no previous file with comments | « ash/display/display_controller.h ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_controller.cc
===================================================================
--- ash/display/display_controller.cc (revision 197747)
+++ ash/display/display_controller.cc (working copy)
@@ -22,16 +22,11 @@
#include "base/stringprintf.h"
#include "base/values.h"
#include "third_party/skia/include/utils/SkMatrix44.h"
-#include "ui/aura/client/activation_client.h"
-#include "ui/aura/client/capture_client.h"
-#include "ui/aura/client/cursor_client.h"
-#include "ui/aura/client/focus_client.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
-#include "ui/aura/window_tracker.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/dip_util.h"
#include "ui/gfx/display.h"
@@ -226,73 +221,6 @@
} // namespace
-namespace internal {
-
-// A utility class to store/restore focused/active window
-// when the display configuration has changed.
-class FocusActivationStore {
- public:
- FocusActivationStore()
- : activation_client_(NULL),
- capture_client_(NULL),
- focus_client_(NULL),
- focused_(NULL),
- active_(NULL) {
- }
-
- void Store() {
- if (!activation_client_) {
- aura::RootWindow* root = Shell::GetPrimaryRootWindow();
- activation_client_ = aura::client::GetActivationClient(root);
- capture_client_ = aura::client::GetCaptureClient(root);
- focus_client_ = aura::client::GetFocusClient(root);
- }
- focused_ = focus_client_->GetFocusedWindow();
- if (focused_)
- tracker_.Add(focused_);
- active_ = activation_client_->GetActiveWindow();
- if (active_ && focused_ != active_)
- tracker_.Add(active_);
-
- // Deactivate the window to close menu / bubble windows.
- activation_client_->DeactivateWindow(active_);
- // Release capture if any.
- capture_client_->SetCapture(NULL);
- // Clear the focused window if any. This is necessary because a
- // window may be deleted when losing focus (fullscreen flash for
- // example). If the focused window is still alive after move, it'll
- // be re-focused below.
- focus_client_->FocusWindow(NULL);
- }
-
- void Restore() {
- // Restore focused or active window if it's still alive.
- if (focused_ && tracker_.Contains(focused_)) {
- focus_client_->FocusWindow(focused_);
- } else if (active_ && tracker_.Contains(active_)) {
- activation_client_->ActivateWindow(active_);
- }
- if (focused_)
- tracker_.Remove(focused_);
- if (active_)
- tracker_.Remove(active_);
- focused_ = NULL;
- active_ = NULL;
- }
-
- private:
- aura::client::ActivationClient* activation_client_;
- aura::client::CaptureClient* capture_client_;
- aura::client::FocusClient* focus_client_;
- aura::WindowTracker tracker_;
- aura::Window* focused_;
- aura::Window* active_;
-
- DISALLOW_COPY_AND_ASSIGN(FocusActivationStore);
-};
-
-} // namespace internal
-
////////////////////////////////////////////////////////////////////////////////
// DisplayLayout
@@ -399,8 +327,7 @@
DisplayController::DisplayController()
: desired_primary_display_id_(gfx::Display::kInvalidDisplayID),
- primary_root_window_for_replace_(NULL),
- focus_activation_store_(new internal::FocusActivationStore()) {
+ primary_root_window_for_replace_(NULL) {
CommandLine* command_line = CommandLine::ForCurrentProcess();
#if defined(OS_CHROMEOS)
if (!command_line->HasSwitch(switches::kAshDisableDisplayChangeLimiter) &&
@@ -973,12 +900,9 @@
void DisplayController::NotifyDisplayConfigurationChanging() {
FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging());
- focus_activation_store_->Store();
}
void DisplayController::NotifyDisplayConfigurationChanged() {
- focus_activation_store_->Restore();
-
internal::DisplayManager* display_manager = GetDisplayManager();
if (display_manager->num_connected_displays() > 1) {
DisplayIdPair pair = GetCurrentDisplayIdPair();
Property changes on: ash/display/display_controller.cc
___________________________________________________________________
Deleted: svn:mergeinfo
« no previous file with comments | « ash/display/display_controller.h ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698