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

Side by Side Diff: ash/common/shelf/shelf_widget.cc

Issue 2676673005: ash: Clean up shelf GetAlignment() and IsHorizontalAlignment() calls (Closed)
Patch Set: Created 3 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
« no previous file with comments | « ash/common/shelf/shelf_widget.h ('k') | ash/common/wm/panels/panel_layout_manager.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/common/shelf/shelf_widget.h" 5 #include "ash/common/shelf/shelf_widget.h"
6 6
7 #include "ash/common/focus_cycler.h" 7 #include "ash/common/focus_cycler.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shelf/app_list_button.h" 10 #include "ash/common/shelf/app_list_button.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 SchedulePaint(); 213 SchedulePaint();
214 } 214 }
215 215
216 ShelfWidget::ShelfWidget(WmWindow* shelf_container, WmShelf* wm_shelf) 216 ShelfWidget::ShelfWidget(WmWindow* shelf_container, WmShelf* wm_shelf)
217 : wm_shelf_(wm_shelf), 217 : wm_shelf_(wm_shelf),
218 status_area_widget_(nullptr), 218 status_area_widget_(nullptr),
219 delegate_view_(new DelegateView(wm_shelf, this)), 219 delegate_view_(new DelegateView(wm_shelf, this)),
220 shelf_view_(nullptr), 220 shelf_view_(nullptr),
221 background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_), 221 background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_),
222 activating_as_fallback_(false) { 222 activating_as_fallback_(false) {
223 DCHECK(wm_shelf_);
223 background_animator_.AddObserver(this); 224 background_animator_.AddObserver(this);
224 background_animator_.AddObserver(delegate_view_); 225 background_animator_.AddObserver(delegate_view_);
225 226
226 views::Widget::InitParams params( 227 views::Widget::InitParams params(
227 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 228 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
228 params.name = "ShelfWidget"; 229 params.name = "ShelfWidget";
229 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 230 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
230 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 231 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
231 params.delegate = delegate_view_; 232 params.delegate = delegate_view_;
232 shelf_container->GetRootWindowController() 233 shelf_container->GetRootWindowController()
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 opaque_foreground_animation->SetPreemptionStrategy( 298 opaque_foreground_animation->SetPreemptionStrategy(
298 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 299 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
299 300
300 opaque_foreground->SetOpacity(target_opacity); 301 opaque_foreground->SetOpacity(target_opacity);
301 } 302 }
302 303
303 bool ShelfWidget::IsShelfHiddenBehindBlackBar() const { 304 bool ShelfWidget::IsShelfHiddenBehindBlackBar() const {
304 return delegate_view_->opaque_foreground()->GetTargetOpacity() != 0.0f; 305 return delegate_view_->opaque_foreground()->GetTargetOpacity() != 0.0f;
305 } 306 }
306 307
307 ShelfAlignment ShelfWidget::GetAlignment() const {
308 return wm_shelf_->GetAlignment();
309 }
310
311 void ShelfWidget::OnShelfAlignmentChanged() { 308 void ShelfWidget::OnShelfAlignmentChanged() {
312 shelf_view_->OnShelfAlignmentChanged(); 309 shelf_view_->OnShelfAlignmentChanged();
313 status_area_widget_->SetShelfAlignment(GetAlignment()); 310 // TODO(jamescook): Status area should not cache alignment.
311 status_area_widget_->SetShelfAlignment(wm_shelf_->GetAlignment());
314 delegate_view_->SchedulePaint(); 312 delegate_view_->SchedulePaint();
315 } 313 }
316 314
317 ShelfView* ShelfWidget::CreateShelfView() { 315 ShelfView* ShelfWidget::CreateShelfView() {
318 DCHECK(!shelf_view_); 316 DCHECK(!shelf_view_);
319 317
320 shelf_view_ = 318 shelf_view_ =
321 new ShelfView(WmShell::Get()->shelf_model(), 319 new ShelfView(WmShell::Get()->shelf_model(),
322 WmShell::Get()->shelf_delegate(), wm_shelf_, this); 320 WmShell::Get()->shelf_delegate(), wm_shelf_, this);
323 shelf_view_->Init(); 321 shelf_view_->Init();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 if (shelf_view_) 434 if (shelf_view_)
437 shelf_view_->UpdateShelfItemBackground(alpha); 435 shelf_view_->UpdateShelfItemBackground(alpha);
438 } 436 }
439 437
440 void ShelfWidget::WillDeleteShelfLayoutManager() { 438 void ShelfWidget::WillDeleteShelfLayoutManager() {
441 shelf_layout_manager_->RemoveObserver(this); 439 shelf_layout_manager_->RemoveObserver(this);
442 shelf_layout_manager_ = nullptr; 440 shelf_layout_manager_ = nullptr;
443 } 441 }
444 442
445 } // namespace ash 443 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_widget.h ('k') | ash/common/wm/panels/panel_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698