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

Side by Side Diff: ash/mus/shelf_delegate_mus.cc

Issue 1877543002: Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update and cleanup tests. Created 4 years, 8 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/content/keyboard_overlay/keyboard_overlay_delegate_unittest.cc ('k') | ash/shelf/shelf.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mus/shelf_delegate_mus.h" 5 #include "ash/mus/shelf_delegate_mus.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/shelf/shelf_item_delegate.h" 10 #include "ash/shelf/shelf_item_delegate.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 SetShelfPreferredSizes(shelf); 128 SetShelfPreferredSizes(shelf);
129 } 129 }
130 130
131 void ShelfDelegateMus::OnShelfDestroyed(Shelf* shelf) { 131 void ShelfDelegateMus::OnShelfDestroyed(Shelf* shelf) {
132 NOTIMPLEMENTED(); 132 NOTIMPLEMENTED();
133 } 133 }
134 134
135 void ShelfDelegateMus::OnShelfAlignmentChanged(Shelf* shelf) { 135 void ShelfDelegateMus::OnShelfAlignmentChanged(Shelf* shelf) {
136 SetShelfPreferredSizes(shelf); 136 SetShelfPreferredSizes(shelf);
137 mash::shelf::mojom::Alignment alignment = 137 mash::shelf::mojom::Alignment alignment =
138 static_cast<mash::shelf::mojom::Alignment>(shelf->GetAlignment()); 138 static_cast<mash::shelf::mojom::Alignment>(shelf->alignment());
139 shelf_layout_->SetAlignment(alignment); 139 shelf_layout_->SetAlignment(alignment);
140 140
141 observers_.ForAllPtrs( 141 observers_.ForAllPtrs(
142 [alignment](mash::shelf::mojom::ShelfObserver* observer) { 142 [alignment](mash::shelf::mojom::ShelfObserver* observer) {
143 observer->OnAlignmentChanged(alignment); 143 observer->OnAlignmentChanged(alignment);
144 }); 144 });
145 } 145 }
146 146
147 void ShelfDelegateMus::OnShelfAutoHideBehaviorChanged(Shelf* shelf) { 147 void ShelfDelegateMus::OnShelfAutoHideBehaviorChanged(Shelf* shelf) {
148 mash::shelf::mojom::AutoHideBehavior behavior = 148 mash::shelf::mojom::AutoHideBehavior behavior =
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 NOTIMPLEMENTED(); 184 NOTIMPLEMENTED();
185 } 185 }
186 186
187 void ShelfDelegateMus::AddObserver( 187 void ShelfDelegateMus::AddObserver(
188 mash::shelf::mojom::ShelfObserverAssociatedPtrInfo observer) { 188 mash::shelf::mojom::ShelfObserverAssociatedPtrInfo observer) {
189 mash::shelf::mojom::ShelfObserverAssociatedPtr observer_ptr; 189 mash::shelf::mojom::ShelfObserverAssociatedPtr observer_ptr;
190 observer_ptr.Bind(std::move(observer)); 190 observer_ptr.Bind(std::move(observer));
191 // Notify the observer of the current state. 191 // Notify the observer of the current state.
192 Shelf* shelf = Shelf::ForPrimaryDisplay(); 192 Shelf* shelf = Shelf::ForPrimaryDisplay();
193 observer_ptr->OnAlignmentChanged( 193 observer_ptr->OnAlignmentChanged(
194 static_cast<mash::shelf::mojom::Alignment>(shelf->GetAlignment())); 194 static_cast<mash::shelf::mojom::Alignment>(shelf->alignment()));
195 observer_ptr->OnAutoHideBehaviorChanged( 195 observer_ptr->OnAutoHideBehaviorChanged(
196 static_cast<mash::shelf::mojom::AutoHideBehavior>( 196 static_cast<mash::shelf::mojom::AutoHideBehavior>(
197 shelf->auto_hide_behavior())); 197 shelf->auto_hide_behavior()));
198 observers_.AddPtr(std::move(observer_ptr)); 198 observers_.AddPtr(std::move(observer_ptr));
199 } 199 }
200 200
201 void ShelfDelegateMus::SetAlignment(mash::shelf::mojom::Alignment alignment) { 201 void ShelfDelegateMus::SetAlignment(mash::shelf::mojom::Alignment alignment) {
202 ShelfAlignment value = static_cast<ShelfAlignment>(alignment); 202 ShelfAlignment value = static_cast<ShelfAlignment>(alignment);
203 Shell::GetInstance()->SetShelfAlignment(value, Shell::GetPrimaryRootWindow()); 203 Shell::GetInstance()->SetShelfAlignment(value, Shell::GetPrimaryRootWindow());
204 } 204 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 StatusAreaWidget* status_widget = widget->status_area_widget(); 330 StatusAreaWidget* status_widget = widget->status_area_widget();
331 mus::Window* status_window = 331 mus::Window* status_window =
332 aura::GetMusWindow(status_widget->GetNativeWindow()); 332 aura::GetMusWindow(status_widget->GetNativeWindow());
333 gfx::Size status_size = status_widget->GetWindowBoundsInScreen().size(); 333 gfx::Size status_size = status_widget->GetWindowBoundsInScreen().size();
334 status_window->SetSharedProperty<gfx::Size>( 334 status_window->SetSharedProperty<gfx::Size>(
335 mus::mojom::WindowManager::kPreferredSize_Property, status_size); 335 mus::mojom::WindowManager::kPreferredSize_Property, status_size);
336 } 336 }
337 337
338 } // namespace sysui 338 } // namespace sysui
339 } // namespace ash 339 } // namespace ash
OLDNEW
« no previous file with comments | « ash/content/keyboard_overlay/keyboard_overlay_delegate_unittest.cc ('k') | ash/shelf/shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698