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

Side by Side Diff: ash/wm/shelf_layout_manager.cc

Issue 10514008: Add WebNotificationTray (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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
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/wm/shelf_layout_manager.h" 5 #include "ash/wm/shelf_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/launcher/launcher.h" 9 #include "ash/launcher/launcher.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_delegate.h" 12 #include "ash/shell_delegate.h"
13 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
14 #include "ash/system/status_area_widget.h" 14 #include "ash/system/status_area_widget.h"
15 #include "ash/system/tray/system_tray.h" 15 #include "ash/system/tray/system_tray.h"
16 #include "ash/system/web_notification/web_notification_tray.h"
16 #include "ash/wm/workspace/workspace_manager.h" 17 #include "ash/wm/workspace/workspace_manager.h"
17 #include "base/auto_reset.h" 18 #include "base/auto_reset.h"
18 #include "base/i18n/rtl.h" 19 #include "base/i18n/rtl.h"
19 #include "ui/aura/client/activation_client.h" 20 #include "ui/aura/client/activation_client.h"
20 #include "ui/aura/event.h" 21 #include "ui/aura/event.h"
21 #include "ui/aura/event_filter.h" 22 #include "ui/aura/event_filter.h"
22 #include "ui/aura/root_window.h" 23 #include "ui/aura/root_window.h"
23 #include "ui/compositor/layer.h" 24 #include "ui/compositor/layer.h"
24 #include "ui/compositor/layer_animation_observer.h" 25 #include "ui/compositor/layer_animation_observer.h"
25 #include "ui/compositor/layer_animator.h" 26 #include "ui/compositor/layer_animator.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (alignment_ == alignment) 194 if (alignment_ == alignment)
194 return false; 195 return false;
195 196
196 alignment_ = alignment; 197 alignment_ = alignment;
197 if (launcher_) 198 if (launcher_)
198 launcher_->SetAlignment(alignment); 199 launcher_->SetAlignment(alignment);
199 if (Shell::GetInstance()->status_area_widget()) 200 if (Shell::GetInstance()->status_area_widget())
200 Shell::GetInstance()->status_area_widget()->SetShelfAlignment(alignment); 201 Shell::GetInstance()->status_area_widget()->SetShelfAlignment(alignment);
201 if (Shell::GetInstance()->system_tray()) 202 if (Shell::GetInstance()->system_tray())
202 Shell::GetInstance()->system_tray()->SetShelfAlignment(alignment); 203 Shell::GetInstance()->system_tray()->SetShelfAlignment(alignment);
204 if (Shell::GetInstance()->web_notification_tray())
205 Shell::GetInstance()->web_notification_tray()->SetShelfAlignment(alignment);
203 LayoutShelf(); 206 LayoutShelf();
204 return true; 207 return true;
205 } 208 }
206 209
207 gfx::Rect ShelfLayoutManager::GetIdealBounds() { 210 gfx::Rect ShelfLayoutManager::GetIdealBounds() {
208 // TODO: this is wrong. Figure out what monitor shelf is on and everything 211 // TODO: this is wrong. Figure out what monitor shelf is on and everything
209 // should be based on it. 212 // should be based on it.
210 gfx::Rect bounds( 213 gfx::Rect bounds(
211 gfx::Screen::GetMonitorNearestWindow(status_->GetNativeView()).bounds()); 214 gfx::Screen::GetMonitorNearestWindow(status_->GetNativeView()).bounds());
212 int width = 0, height = 0; 215 int width = 0, height = 0;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 BackgroundAnimator::ChangeType type) { 495 BackgroundAnimator::ChangeType type) {
493 bool launcher_paints = GetLauncherPaintsBackground(); 496 bool launcher_paints = GetLauncherPaintsBackground();
494 if (launcher_) 497 if (launcher_)
495 launcher_->SetPaintsBackground(launcher_paints, type); 498 launcher_->SetPaintsBackground(launcher_paints, type);
496 // SystemTray normally draws a background, but we don't want it to draw a 499 // SystemTray normally draws a background, but we don't want it to draw a
497 // background when the launcher does. 500 // background when the launcher does.
498 if (Shell::GetInstance()->system_tray()) { 501 if (Shell::GetInstance()->system_tray()) {
499 Shell::GetInstance()->system_tray()->SetPaintsBackground( 502 Shell::GetInstance()->system_tray()->SetPaintsBackground(
500 !launcher_paints, type); 503 !launcher_paints, type);
501 } 504 }
505 if (Shell::GetInstance()->web_notification_tray()) {
506 Shell::GetInstance()->web_notification_tray()->SetPaintsBackground(
507 !launcher_paints, type);
508 }
502 } 509 }
503 510
504 bool ShelfLayoutManager::GetLauncherPaintsBackground() const { 511 bool ShelfLayoutManager::GetLauncherPaintsBackground() const {
505 return (!state_.is_screen_locked && window_overlaps_shelf_) || 512 return (!state_.is_screen_locked && window_overlaps_shelf_) ||
506 state_.visibility_state == AUTO_HIDE; 513 state_.visibility_state == AUTO_HIDE;
507 } 514 }
508 515
509 void ShelfLayoutManager::UpdateAutoHideStateNow() { 516 void ShelfLayoutManager::UpdateAutoHideStateNow() {
510 SetState(state_.visibility_state); 517 SetState(state_.visibility_state);
511 } 518 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { 582 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const {
576 if (state.visibility_state == VISIBLE) 583 if (state.visibility_state == VISIBLE)
577 return size; 584 return size;
578 if (state.visibility_state == AUTO_HIDE) 585 if (state.visibility_state == AUTO_HIDE)
579 return kAutoHideSize; 586 return kAutoHideSize;
580 return 0; 587 return 0;
581 } 588 }
582 589
583 } // namespace internal 590 } // namespace internal
584 } // namespace ash 591 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698