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

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

Issue 1645503004: [exp] ash: sysui for mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ash-in-mus
Patch Set: . Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ash_popup_alignment_delegate.h" 5 #include "ash/system/web_notification/ash_popup_alignment_delegate.h"
6 6
7 #include "ash/display/window_tree_host_manager.h" 7 #include "ash/display/window_tree_host_manager.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf_constants.h" 9 #include "ash/shelf/shelf_constants.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 15 matching lines...) Expand all
26 const int kToastMarginX = 3; 26 const int kToastMarginX = 3;
27 27
28 // If there should be no margin for the first item, this value needs to be 28 // If there should be no margin for the first item, this value needs to be
29 // substracted to flush the message to the shelf (the width of the border + 29 // substracted to flush the message to the shelf (the width of the border +
30 // shadow). 30 // shadow).
31 const int kNoToastMarginBorderAndShadowOffset = 2; 31 const int kNoToastMarginBorderAndShadowOffset = 2;
32 32
33 } 33 }
34 34
35 AshPopupAlignmentDelegate::AshPopupAlignmentDelegate(ShelfLayoutManager* shelf) 35 AshPopupAlignmentDelegate::AshPopupAlignmentDelegate(ShelfLayoutManager* shelf)
36 : screen_(NULL), root_window_(NULL), shelf_(shelf), system_tray_height_(0) { 36 : screen_(NULL), shelf_(shelf), system_tray_height_(0) {
37 shelf_->AddObserver(this); 37 shelf_->AddObserver(this);
38 } 38 }
39 39
40 AshPopupAlignmentDelegate::~AshPopupAlignmentDelegate() { 40 AshPopupAlignmentDelegate::~AshPopupAlignmentDelegate() {
41 if (screen_) 41 if (screen_)
42 screen_->RemoveObserver(this); 42 screen_->RemoveObserver(this);
43 Shell::GetInstance()->RemoveShellObserver(this); 43 Shell::GetInstance()->RemoveShellObserver(this);
44 shelf_->RemoveObserver(this); 44 shelf_->RemoveObserver(this);
45 } 45 }
46 46
47 void AshPopupAlignmentDelegate::StartObserving(gfx::Screen* screen, 47 void AshPopupAlignmentDelegate::StartObserving(gfx::Screen* screen,
48 const gfx::Display& display) { 48 const gfx::Display& display) {
49 screen_ = screen; 49 screen_ = screen;
50 work_area_ = display.work_area(); 50 work_area_ = display.work_area();
51 root_window_ = ash::Shell::GetInstance()
52 ->window_tree_host_manager()
53 ->GetRootWindowForDisplayId(display.id());
54 screen->AddObserver(this); 51 screen->AddObserver(this);
55 Shell::GetInstance()->AddShellObserver(this); 52 Shell::GetInstance()->AddShellObserver(this);
56 if (system_tray_height_ > 0) 53 if (system_tray_height_ > 0)
57 UpdateWorkArea(); 54 UpdateWorkArea();
58 } 55 }
59 56
60 void AshPopupAlignmentDelegate::SetSystemTrayHeight(int height) { 57 void AshPopupAlignmentDelegate::SetSystemTrayHeight(int height) {
61 system_tray_height_ = height; 58 system_tray_height_ = height;
62 59
63 // If the shelf is shown during auto-hide state, the distance from the edge 60 // If the shelf is shown during auto-hide state, the distance from the edge
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 146 }
150 147
151 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( 148 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged(
152 const gfx::Display& display, 149 const gfx::Display& display,
153 uint32_t metrics) { 150 uint32_t metrics) {
154 if (GetCurrentDisplay().id() == display.id()) 151 if (GetCurrentDisplay().id() == display.id())
155 UpdateWorkArea(); 152 UpdateWorkArea();
156 } 153 }
157 154
158 } // namespace ash 155 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698