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

Side by Side Diff: content/browser/web_contents/aura/native_view_screen_bounds_observer.h

Issue 54623007: Make code path for bounds changes getting to renderer less brittle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Experimenting with single observer design Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 void OnScreenPositionChanged() = 0;
23 virtual void OnScreenBoundsChanged() = 0;
24
25 private:
26 DISALLOW_COPY_AND_ASSIGN(NativeViewScreenBoundsObserverDelegate);
27 };
28
29 class CONTENT_EXPORT NativeViewScreenBoundsObserver
30 : public aura::WindowObserver,
31 public aura::RootWindowObserver {
32 public:
33 explicit NativeViewScreenBoundsObserver
34 (NativeViewScreenBoundsObserverDelegate* delegate,
35 aura::Window* window);
36 virtual ~NativeViewScreenBoundsObserver();
37
38 // Overridden from aura::WindowObserver:
39 virtual void OnWindowParentChanged(aura::Window* window,
40 aura::Window* parent) OVERRIDE;
41 virtual void OnWindowBoundsChanged(aura::Window* window,
42 const gfx::Rect& old_bounds,
43 const gfx::Rect& new_bounds) OVERRIDE;
44 virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE;
45 virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE;
46
47 // Overridden RootWindowObserver:
48 virtual void OnRootWindowHostMoved(const aura::RootWindow* root,
49 const gfx::Point& new_origin) OVERRIDE;
50
51 private:
52 friend class NativeViewScreenBoundsObserverTest;
53
54 std::set<aura::Window*> CollectAllWindowsToRoot(aura::Window* window);
55 void AddToObserved(const std::set<aura::Window*>& windows);
56 void RemoveFromObserved(const std::set<aura::Window*>& windows);
57
58 NativeViewScreenBoundsObserverDelegate* delegate_;
59 aura::Window* window_;
60 std::set<aura::Window*> observed_;
61
62 DISALLOW_COPY_AND_ASSIGN(NativeViewScreenBoundsObserver);
63 };
64
65 } // namespace content
66 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_NATIVE_VIEW_SCREEN_BOUNDS_OBSERVER_ H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698