Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_NATIVE_VIEW_SCREEN_BOUNDS_OBSERVER_H__ | |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_NATIVE_VIEW_SCREEN_BOUNDS_OBSERVER_H__ | |
| 7 | |
| 8 #include <set> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "content/common/content_export.h" | |
| 12 #include "ui/aura/root_window_observer.h" | |
| 13 #include "ui/aura/window_observer.h" | |
| 14 | |
| 15 namespace content { | |
| 16 | |
| 17 class CONTENT_EXPORT NativeViewScreenBoundsObserverDelegate { | |
| 18 public: | |
| 19 NativeViewScreenBoundsObserverDelegate() { } | |
| 20 virtual ~NativeViewScreenBoundsObserverDelegate() { } | |
| 21 | |
| 22 virtual aura::Window* GetDelegateWindow() = 0; | |
| 23 virtual void AddDelegateWindowObserver(aura::WindowObserver* observer) = 0; | |
| 24 virtual void RemoveDelegateWindowObserver(aura::WindowObserver* observer) = 0; | |
| 25 virtual void AddRootWindowObserver(aura::RootWindowObserver* observer) = 0; | |
| 26 virtual void RemoveRootWindowObserver(aura::RootWindowObserver* observer) = 0; | |
|
sadrul
2013/11/08 02:16:26
You don't need any of the above in this interface.
rharrison
2013/11/12 22:16:29
Done.
| |
| 27 virtual void OnScreenPositionChanged() = 0; | |
| 28 virtual void OnScreenBoundsChanged() = 0; | |
| 29 | |
| 30 private: | |
| 31 DISALLOW_COPY_AND_ASSIGN(NativeViewScreenBoundsObserverDelegate); | |
| 32 }; | |
| 33 | |
| 34 class CONTENT_EXPORT NativeViewScreenBoundsObserver | |
| 35 : public aura::WindowObserver, | |
| 36 public aura::RootWindowObserver { | |
| 37 public: | |
| 38 NativeViewScreenBoundsObserver(); | |
| 39 virtual ~NativeViewScreenBoundsObserver(); | |
| 40 | |
| 41 virtual void Init(NativeViewScreenBoundsObserverDelegate* delegate); | |
|
sadrul
2013/11/08 02:16:26
This doesn't need to be virtual?
rharrison
2013/11/12 22:16:29
Done.
| |
| 42 | |
| 43 // Overridden from aura::WindowObserver: | |
| 44 virtual void OnWindowParentChanged(aura::Window* window, | |
| 45 aura::Window* parent) OVERRIDE; | |
| 46 virtual void OnWindowBoundsChanged(aura::Window* window, | |
| 47 const gfx::Rect& old_bounds, | |
| 48 const gfx::Rect& new_bounds) OVERRIDE; | |
| 49 virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE; | |
| 50 virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE; | |
| 51 | |
| 52 // Overridden RootWindowObserver: | |
| 53 virtual void OnRootWindowHostMoved(const aura::RootWindow* root, | |
| 54 const gfx::Point& new_origin) OVERRIDE; | |
| 55 | |
| 56 private: | |
| 57 friend class NativeViewScreenBoundsObserverTest; | |
| 58 | |
| 59 | |
| 60 std::set<aura::Window*> GenerateAncestors(aura::Window* window); | |
| 61 void AddToObserved(const std::set<aura::Window*>& windows); | |
| 62 void RemoveFromObserved(const std::set<aura::Window*>& windows); | |
| 63 | |
| 64 NativeViewScreenBoundsObserverDelegate* delegate_; | |
| 65 std::set<aura::Window*> observed_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(NativeViewScreenBoundsObserver); | |
| 68 }; | |
| 69 | |
| 70 } // namespace content | |
| 71 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_NATIVE_VIEW_SCREEN_BOUNDS_OBSERVER_ H__ | |
| OLD | NEW |