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

Side by Side Diff: ash/system/tray/tray_background_view.cc

Issue 1929023002: Refactors WindowResizers to use ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move forward declaration Created 4 years, 7 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
« no previous file with comments | « ash/system/tray/system_tray.cc ('k') | ash/system/tray/tray_image_item.cc » ('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/tray/tray_background_view.h" 5 #include "ash/system/tray/tray_background_view.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_util.h" 10 #include "ash/shelf/shelf_util.h"
11 #include "ash/shelf/shelf_widget.h" 11 #include "ash/shelf/shelf_widget.h"
12 #include "ash/shell.h" 12 #include "ash/shell.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/status_area_widget_delegate.h" 15 #include "ash/system/status_area_widget_delegate.h"
16 #include "ash/system/tray/system_tray.h" 16 #include "ash/system/tray/system_tray.h"
17 #include "ash/system/tray/tray_constants.h" 17 #include "ash/system/tray/tray_constants.h"
18 #include "ash/system/tray/tray_event_filter.h" 18 #include "ash/system/tray/tray_event_filter.h"
19 #include "ash/wm/common/shelf/wm_shelf_util.h"
19 #include "ash/wm/window_animations.h" 20 #include "ash/wm/window_animations.h"
20 #include "base/command_line.h" 21 #include "base/command_line.h"
21 #include "grit/ash_resources.h" 22 #include "grit/ash_resources.h"
22 #include "ui/accessibility/ax_view_state.h" 23 #include "ui/accessibility/ax_view_state.h"
23 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
24 #include "ui/aura/window_event_dispatcher.h" 25 #include "ui/aura/window_event_dispatcher.h"
25 #include "ui/base/nine_image_painter_factory.h" 26 #include "ui/base/nine_image_painter_factory.h"
26 #include "ui/base/ui_base_switches_util.h" 27 #include "ui/base/ui_base_switches_util.h"
27 #include "ui/compositor/layer.h" 28 #include "ui/compositor/layer.h"
28 #include "ui/compositor/layer_animation_element.h" 29 #include "ui/compositor/layer_animation_element.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 187
187 void TrayBackgroundView::TrayContainer::ViewHierarchyChanged( 188 void TrayBackgroundView::TrayContainer::ViewHierarchyChanged(
188 const ViewHierarchyChangedDetails& details) { 189 const ViewHierarchyChangedDetails& details) {
189 if (details.parent == this) 190 if (details.parent == this)
190 PreferredSizeChanged(); 191 PreferredSizeChanged();
191 } 192 }
192 193
193 void TrayBackgroundView::TrayContainer::UpdateLayout() { 194 void TrayBackgroundView::TrayContainer::UpdateLayout() {
194 // Adjust the size of status tray dark background by adding additional 195 // Adjust the size of status tray dark background by adding additional
195 // empty border. 196 // empty border.
196 if (IsHorizontalAlignment(alignment_)) { 197 if (wm::IsHorizontalAlignment(alignment_)) {
197 SetBorder(views::Border::CreateEmptyBorder( 198 SetBorder(views::Border::CreateEmptyBorder(
198 kPaddingFromEdgeOfShelf, 199 kPaddingFromEdgeOfShelf,
199 kPaddingFromEdgeOfShelf, 200 kPaddingFromEdgeOfShelf,
200 kPaddingFromEdgeOfShelf, 201 kPaddingFromEdgeOfShelf,
201 kPaddingFromEdgeOfShelf)); 202 kPaddingFromEdgeOfShelf));
202 203
203 views::BoxLayout* layout = 204 views::BoxLayout* layout =
204 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); 205 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0);
205 layout->SetDefaultFlex(1); 206 layout->SetDefaultFlex(1);
206 views::View::SetLayoutManager(layout); 207 views::View::SetLayoutManager(layout);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 shelf_alignment_ = alignment; 398 shelf_alignment_ = alignment;
398 SetTrayBorder(); 399 SetTrayBorder();
399 tray_container_->SetAlignment(alignment); 400 tray_container_->SetAlignment(alignment);
400 } 401 }
401 402
402 void TrayBackgroundView::SetTrayBorder() { 403 void TrayBackgroundView::SetTrayBorder() {
403 views::View* parent = status_area_widget_->status_area_widget_delegate(); 404 views::View* parent = status_area_widget_->status_area_widget_delegate();
404 // Tray views are laid out right-to-left or bottom-to-top 405 // Tray views are laid out right-to-left or bottom-to-top
405 bool on_edge = (this == parent->child_at(0)); 406 bool on_edge = (this == parent->child_at(0));
406 int left_edge, top_edge, right_edge, bottom_edge; 407 int left_edge, top_edge, right_edge, bottom_edge;
407 if (IsHorizontalAlignment(shelf_alignment())) { 408 if (wm::IsHorizontalAlignment(shelf_alignment())) {
408 top_edge = ShelfLayoutManager::kShelfItemInset; 409 top_edge = ShelfLayoutManager::kShelfItemInset;
409 left_edge = 0; 410 left_edge = 0;
410 bottom_edge = kShelfSize - 411 bottom_edge = kShelfSize -
411 ShelfLayoutManager::kShelfItemInset - kShelfItemHeight; 412 ShelfLayoutManager::kShelfItemInset - kShelfItemHeight;
412 right_edge = on_edge ? kPaddingFromEdgeOfShelf : 0; 413 right_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
413 } else if (shelf_alignment() == wm::SHELF_ALIGNMENT_LEFT) { 414 } else if (shelf_alignment() == wm::SHELF_ALIGNMENT_LEFT) {
414 top_edge = 0; 415 top_edge = 0;
415 left_edge = kShelfSize - 416 left_edge = kShelfSize -
416 ShelfLayoutManager::kShelfItemInset - kShelfItemHeight; 417 ShelfLayoutManager::kShelfItemInset - kShelfItemHeight;
417 bottom_edge = on_edge ? kPaddingFromEdgeOfShelf : 0; 418 bottom_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
(...skipping 26 matching lines...) Expand all
444 // This is needed so that OnImplicitAnimationsCompleted() is called even upon 445 // This is needed so that OnImplicitAnimationsCompleted() is called even upon
445 // destruction of the animator. This can occure when parallel animations 446 // destruction of the animator. This can occure when parallel animations
446 // caused by ScreenRotationAnimator end before the animations of 447 // caused by ScreenRotationAnimator end before the animations of
447 // TrayBackgroundView. This allows for a proper update to the visual state of 448 // TrayBackgroundView. This allows for a proper update to the visual state of
448 // the view. (crbug.com/476667) 449 // the view. (crbug.com/476667)
449 return true; 450 return true;
450 } 451 }
451 452
452 void TrayBackgroundView::HideTransformation() { 453 void TrayBackgroundView::HideTransformation() {
453 gfx::Transform transform; 454 gfx::Transform transform;
454 if (IsHorizontalAlignment(shelf_alignment_)) 455 if (wm::IsHorizontalAlignment(shelf_alignment_))
455 transform.Translate(width(), 0.0f); 456 transform.Translate(width(), 0.0f);
456 else 457 else
457 transform.Translate(0.0f, height()); 458 transform.Translate(0.0f, height());
458 layer()->SetTransform(transform); 459 layer()->SetTransform(transform);
459 } 460 }
460 461
461 void TrayBackgroundView::InitializeBubbleAnimations( 462 void TrayBackgroundView::InitializeBubbleAnimations(
462 views::Widget* bubble_widget) { 463 views::Widget* bubble_widget) {
463 ::wm::SetWindowVisibilityAnimationType( 464 ::wm::SetWindowVisibilityAnimationType(
464 bubble_widget->GetNativeWindow(), 465 bubble_widget->GetNativeWindow(),
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 background_->set_alpha(kTrayBackgroundAlpha); 583 background_->set_alpha(kTrayBackgroundAlpha);
583 SchedulePaint(); 584 SchedulePaint();
584 } 585 }
585 586
586 void TrayBackgroundView::UpdateBubbleViewArrow( 587 void TrayBackgroundView::UpdateBubbleViewArrow(
587 views::TrayBubbleView* bubble_view) { 588 views::TrayBubbleView* bubble_view) {
588 // Nothing to do here. 589 // Nothing to do here.
589 } 590 }
590 591
591 } // namespace ash 592 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray.cc ('k') | ash/system/tray/tray_image_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698