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

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: Rebase 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 BackgroundAnimator::ChangeType type) { 493 BackgroundAnimator::ChangeType type) {
491 bool launcher_paints = GetLauncherPaintsBackground(); 494 bool launcher_paints = GetLauncherPaintsBackground();
492 if (launcher_) 495 if (launcher_)
493 launcher_->SetPaintsBackground(launcher_paints, type); 496 launcher_->SetPaintsBackground(launcher_paints, type);
494 // SystemTray normally draws a background, but we don't want it to draw a 497 // SystemTray normally draws a background, but we don't want it to draw a
495 // background when the launcher does. 498 // background when the launcher does.
496 if (Shell::GetInstance()->system_tray()) { 499 if (Shell::GetInstance()->system_tray()) {
497 Shell::GetInstance()->system_tray()->SetPaintsBackground( 500 Shell::GetInstance()->system_tray()->SetPaintsBackground(
498 !launcher_paints, type); 501 !launcher_paints, type);
499 } 502 }
503 if (Shell::GetInstance()->web_notification_tray()) {
504 Shell::GetInstance()->web_notification_tray()->SetPaintsBackground(
505 !launcher_paints, type);
506 }
500 } 507 }
501 508
502 bool ShelfLayoutManager::GetLauncherPaintsBackground() const { 509 bool ShelfLayoutManager::GetLauncherPaintsBackground() const {
503 return (!state_.is_screen_locked && window_overlaps_shelf_) || 510 return (!state_.is_screen_locked && window_overlaps_shelf_) ||
504 state_.visibility_state == AUTO_HIDE; 511 state_.visibility_state == AUTO_HIDE;
505 } 512 }
506 513
507 void ShelfLayoutManager::UpdateAutoHideStateNow() { 514 void ShelfLayoutManager::UpdateAutoHideStateNow() {
508 SetState(state_.visibility_state); 515 SetState(state_.visibility_state);
509 } 516 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { 580 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const {
574 if (state.visibility_state == VISIBLE) 581 if (state.visibility_state == VISIBLE)
575 return size; 582 return size;
576 if (state.visibility_state == AUTO_HIDE) 583 if (state.visibility_state == AUTO_HIDE)
577 return kAutoHideSize; 584 return kAutoHideSize;
578 return 0; 585 return 0;
579 } 586 }
580 587
581 } // namespace internal 588 } // namespace internal
582 } // namespace ash 589 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698