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

Unified Diff: ash/shell.h

Issue 2739553005: Moves maintaining root_window_for_new_windows_ to Shell (Closed)
Patch Set: remove ash:: Created 3 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 | « ash/root_window_controller.cc ('k') | ash/shell.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shell.h
diff --git a/ash/shell.h b/ash/shell.h
index f17b9a7ff4f43451afc62a32461332619be0d26f..81ffb0d2239a0d2847a46e3d46c98948631a3535 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -22,6 +22,7 @@
#include "ui/display/screen.h"
#include "ui/events/event_target.h"
#include "ui/wm/core/cursor_manager.h"
+#include "ui/wm/public/activation_change_observer.h"
namespace aura {
class RootWindow;
@@ -31,7 +32,6 @@ class WindowManagerClient;
class WindowTreeClient;
namespace client {
class ActivationClient;
-class FocusClient;
}
}
@@ -65,6 +65,7 @@ class TooltipController;
namespace wm {
class AcceleratorFilter;
class CompoundEventFilter;
+class FocusController;
class ShadowController;
class VisibilityController;
class WindowModalityController;
@@ -141,7 +142,8 @@ class SmsObserverTest;
// Upon creation, the Shell sets itself as the RootWindow's delegate, which
// takes ownership of the Shell.
class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
- public ui::EventTarget {
+ public ui::EventTarget,
+ public aura::client::ActivationChangeObserver {
public:
typedef std::vector<RootWindowController*> RootWindowControllerList;
@@ -175,16 +177,12 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
// has a launcher.
static aura::Window* GetPrimaryRootWindow();
- // Returns a root Window when used as a target when creating a new window.
- // The root window of the active window is used in most cases, but can
- // be overridden by using ScopedRootWindowForNewWindows.
- // If you want to get the root Window of the active window, just use
- // |wm::GetActiveWindow()->GetRootWindow()|.
- static aura::Window* GetTargetRootWindow();
-
- // Returns the id of the display::Display corresponding to the window returned
- // by |GetTargetRootWindow()|
- static int64_t GetTargetDisplayId();
+ // Returns the root window that newly created windows should be added to.
+ // Value can be temporarily overridden using ScopedRootWindowForNewWindows.
+ // NOTE: this returns the root, newly created window should be added to the
+ // appropriate container in the returned window.
+ static aura::Window* GetRootWindowForNewWindows();
+ static WmWindow* GetWmRootWindowForNewWindows();
// Returns all root windows.
static aura::Window::Windows GetAllRootWindows();
@@ -318,9 +316,7 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
return autoclick_controller_.get();
}
- aura::client::ActivationClient* activation_client() {
- return activation_client_;
- }
+ aura::client::ActivationClient* activation_client();
// Force the shelf to query for it's current visibility state.
// TODO(jamescook): Move to Shelf.
@@ -389,6 +385,11 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
return is_touch_hud_projection_enabled_;
}
+ // NOTE: Prefer ScopedRootWindowForNewWindows when setting temporarily.
+ void set_root_window_for_new_windows(WmWindow* root) {
+ root_window_for_new_windows_ = root;
+ }
+
// Creates instance of FirstRunHelper. Caller is responsible for deleting
// returned object.
ash::FirstRunHelper* CreateFirstRunHelper();
@@ -414,9 +415,10 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
friend class RootWindowController;
+ friend class ScopedRootWindowForNewWindows;
+ friend class SmsObserverTest;
friend class test::ShellTestApi;
friend class shell::WindowWatcher;
- friend class SmsObserverTest;
explicit Shell(std::unique_ptr<WmShell> wm_shell);
~Shell() override;
@@ -441,6 +443,11 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override;
ui::EventTargeter* GetEventTargeter() override;
+ // aura::client::ActivationChangeObserver:
+ void OnWindowActivated(ActivationReason reason,
+ aura::Window* gained_active,
+ aura::Window* lost_active) override;
+
static Shell* instance_;
// Only valid in mash, for classic ash this is null.
@@ -479,9 +486,7 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
std::unique_ptr<HighContrastController> high_contrast_controller_;
std::unique_ptr<MagnificationController> magnification_controller_;
std::unique_ptr<AutoclickController> autoclick_controller_;
- std::unique_ptr<aura::client::FocusClient> focus_client_;
-
- aura::client::ActivationClient* activation_client_;
+ std::unique_ptr<::wm::FocusController> focus_controller_;
std::unique_ptr<ScreenshotController> screenshot_controller_;
@@ -564,6 +569,10 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
bool is_touch_hud_projection_enabled_;
+ // See comment for GetWmRootWindowForNewWindows().
+ WmWindow* root_window_for_new_windows_ = nullptr;
+ WmWindow* scoped_root_window_for_new_windows_ = nullptr;
+
// Injected content::GPUDataManager support.
std::unique_ptr<GPUSupport> gpu_support_;
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698