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

Side by Side Diff: ash/system/web_notification/web_notification_tray.cc

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/tray/tray_event_filter.cc ('k') | ash/test/ash_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/system/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_layout_manager_observer.h" 10 #include "ash/shelf/shelf_layout_manager_observer.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 class WorkAreaObserver : public ShelfLayoutManagerObserver, 76 class WorkAreaObserver : public ShelfLayoutManagerObserver,
77 public ShellObserver { 77 public ShellObserver {
78 public: 78 public:
79 WorkAreaObserver(); 79 WorkAreaObserver();
80 virtual ~WorkAreaObserver(); 80 virtual ~WorkAreaObserver();
81 81
82 void SetSystemTrayHeight(int height); 82 void SetSystemTrayHeight(int height);
83 83
84 // Starts observing |shelf| and shell and sends the change to |collection|. 84 // Starts observing |shelf| and shell and sends the change to |collection|.
85 void StartObserving(message_center::MessagePopupCollection* collection, 85 void StartObserving(message_center::MessagePopupCollection* collection,
86 aura::RootWindow* root_window); 86 aura::Window* root_window);
87 87
88 // Stops the observing session. 88 // Stops the observing session.
89 void StopObserving(); 89 void StopObserving();
90 90
91 // Overridden from ShellObserver: 91 // Overridden from ShellObserver:
92 virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE; 92 virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE;
93 93
94 // Overridden from ShelfLayoutManagerObserver: 94 // Overridden from ShelfLayoutManagerObserver:
95 virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) OVERRIDE; 95 virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) OVERRIDE;
96 96
97 private: 97 private:
98 // Updates |shelf_| from |root_window_|. 98 // Updates |shelf_| from |root_window_|.
99 void UpdateShelf(); 99 void UpdateShelf();
100 100
101 message_center::MessagePopupCollection* collection_; 101 message_center::MessagePopupCollection* collection_;
102 aura::RootWindow* root_window_; 102 aura::Window* root_window_;
103 ShelfLayoutManager* shelf_; 103 ShelfLayoutManager* shelf_;
104 int system_tray_height_; 104 int system_tray_height_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(WorkAreaObserver); 106 DISALLOW_COPY_AND_ASSIGN(WorkAreaObserver);
107 }; 107 };
108 108
109 WorkAreaObserver::WorkAreaObserver() 109 WorkAreaObserver::WorkAreaObserver()
110 : collection_(NULL), 110 : collection_(NULL),
111 root_window_(NULL), 111 root_window_(NULL),
112 shelf_(NULL), 112 shelf_(NULL),
(...skipping 19 matching lines...) Expand all
132 system_tray_height_ += message_center::kMarginBetweenItems; 132 system_tray_height_ += message_center::kMarginBetweenItems;
133 133
134 if (!shelf_) 134 if (!shelf_)
135 return; 135 return;
136 136
137 OnAutoHideStateChanged(shelf_->auto_hide_state()); 137 OnAutoHideStateChanged(shelf_->auto_hide_state());
138 } 138 }
139 139
140 void WorkAreaObserver::StartObserving( 140 void WorkAreaObserver::StartObserving(
141 message_center::MessagePopupCollection* collection, 141 message_center::MessagePopupCollection* collection,
142 aura::RootWindow* root_window) { 142 aura::Window* root_window) {
143 DCHECK(collection); 143 DCHECK(collection);
144 collection_ = collection; 144 collection_ = collection;
145 root_window_ = root_window; 145 root_window_ = root_window;
146 UpdateShelf(); 146 UpdateShelf();
147 Shell::GetInstance()->AddShellObserver(this); 147 Shell::GetInstance()->AddShellObserver(this);
148 if (system_tray_height_ > 0) 148 if (system_tray_height_ > 0)
149 OnAutoHideStateChanged(shelf_->auto_hide_state()); 149 OnAutoHideStateChanged(shelf_->auto_hide_state());
150 } 150 }
151 151
152 void WorkAreaObserver::StopObserving() { 152 void WorkAreaObserver::StopObserving() {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 int max_height = 0; 343 int max_height = 0;
344 aura::Window* status_area_window = status_area_widget()->GetNativeView(); 344 aura::Window* status_area_window = status_area_widget()->GetNativeView();
345 switch (GetShelfLayoutManager()->GetAlignment()) { 345 switch (GetShelfLayoutManager()->GetAlignment()) {
346 case SHELF_ALIGNMENT_BOTTOM: { 346 case SHELF_ALIGNMENT_BOTTOM: {
347 gfx::Rect shelf_bounds = GetShelfLayoutManager()->GetIdealBounds(); 347 gfx::Rect shelf_bounds = GetShelfLayoutManager()->GetIdealBounds();
348 max_height = shelf_bounds.y(); 348 max_height = shelf_bounds.y();
349 break; 349 break;
350 } 350 }
351 case SHELF_ALIGNMENT_TOP: { 351 case SHELF_ALIGNMENT_TOP: {
352 aura::RootWindow* root = status_area_window->GetRootWindow(); 352 aura::Window* root = status_area_window->GetRootWindow();
353 max_height = 353 max_height =
354 root->bounds().height() - status_area_window->bounds().height(); 354 root->bounds().height() - status_area_window->bounds().height();
355 break; 355 break;
356 } 356 }
357 case SHELF_ALIGNMENT_LEFT: 357 case SHELF_ALIGNMENT_LEFT:
358 case SHELF_ALIGNMENT_RIGHT: { 358 case SHELF_ALIGNMENT_RIGHT: {
359 // Assume that the bottom line of the status area widget and the bubble 359 // Assume that the bottom line of the status area widget and the bubble
360 // are aligned. 360 // are aligned.
361 max_height = status_area_window->GetBoundsInRootWindow().bottom(); 361 max_height = status_area_window->GetBoundsInRootWindow().bottom();
362 break; 362 break;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 607
608 message_center::MessageCenterBubble* 608 message_center::MessageCenterBubble*
609 WebNotificationTray::GetMessageCenterBubbleForTest() { 609 WebNotificationTray::GetMessageCenterBubbleForTest() {
610 if (!message_center_bubble()) 610 if (!message_center_bubble())
611 return NULL; 611 return NULL;
612 return static_cast<message_center::MessageCenterBubble*>( 612 return static_cast<message_center::MessageCenterBubble*>(
613 message_center_bubble()->bubble()); 613 message_center_bubble()->bubble());
614 } 614 }
615 615
616 } // namespace ash 616 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_event_filter.cc ('k') | ash/test/ash_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698