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

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

Issue 1921403002: Pin apps from prefs on the mash shelf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only use ChromeMashShelfController with use_ash=1. 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/mus/shelf_delegate_mus.h ('k') | chrome/browser/BUILD.gn » ('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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 ShelfItemDelegateMus* item_delegate = GetShelfItemDelegate(shelf_id); 306 ShelfItemDelegateMus* item_delegate = GetShelfItemDelegate(shelf_id);
307 DCHECK(item_delegate->pinned()); 307 DCHECK(item_delegate->pinned());
308 item_delegate->set_pinned(false); 308 item_delegate->set_pinned(false);
309 if (item_delegate->window_id_to_title().empty()) { 309 if (item_delegate->window_id_to_title().empty()) {
310 model_->RemoveItemAt(model_->ItemIndexByID(shelf_id)); 310 model_->RemoveItemAt(model_->ItemIndexByID(shelf_id));
311 app_id_to_shelf_id_.erase(app_id.To<std::string>()); 311 app_id_to_shelf_id_.erase(app_id.To<std::string>());
312 shelf_id_to_app_id_.erase(shelf_id); 312 shelf_id_to_app_id_.erase(shelf_id);
313 } 313 }
314 } 314 }
315 315
316 void ShelfDelegateMus::SetItemImage(const mojo::String& app_id,
317 skia::mojom::BitmapPtr image) {
318 if (!app_id_to_shelf_id_.count(app_id.To<std::string>()))
319 return;
320 ShelfID shelf_id = app_id_to_shelf_id_[app_id.To<std::string>()];
321 int index = model_->ItemIndexByID(shelf_id);
322 DCHECK_GE(index, 0);
323 ShelfItem item = *model_->ItemByID(shelf_id);
324 item.image = GetShelfIconFromBitmap(image.To<SkBitmap>());
325 model_->Set(index, item);
326 }
327
316 void ShelfDelegateMus::OnUserWindowObserverAdded( 328 void ShelfDelegateMus::OnUserWindowObserverAdded(
317 mojo::Array<mash::wm::mojom::UserWindowPtr> user_windows) { 329 mojo::Array<mash::wm::mojom::UserWindowPtr> user_windows) {
318 for (size_t i = 0; i < user_windows.size(); ++i) 330 for (size_t i = 0; i < user_windows.size(); ++i)
319 OnUserWindowAdded(std::move(user_windows[i])); 331 OnUserWindowAdded(std::move(user_windows[i]));
320 } 332 }
321 333
322 void ShelfDelegateMus::OnUserWindowAdded( 334 void ShelfDelegateMus::OnUserWindowAdded(
323 mash::wm::mojom::UserWindowPtr user_window) { 335 mash::wm::mojom::UserWindowPtr user_window) {
324 DCHECK(!window_id_to_shelf_id_.count(user_window->window_id)); 336 DCHECK(!window_id_to_shelf_id_.count(user_window->window_id));
325 337
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 StatusAreaWidget* status_widget = widget->status_area_widget(); 439 StatusAreaWidget* status_widget = widget->status_area_widget();
428 mus::Window* status_window = 440 mus::Window* status_window =
429 aura::GetMusWindow(status_widget->GetNativeWindow()); 441 aura::GetMusWindow(status_widget->GetNativeWindow());
430 gfx::Size status_size = status_widget->GetWindowBoundsInScreen().size(); 442 gfx::Size status_size = status_widget->GetWindowBoundsInScreen().size();
431 status_window->SetSharedProperty<gfx::Size>( 443 status_window->SetSharedProperty<gfx::Size>(
432 mus::mojom::WindowManager::kPreferredSize_Property, status_size); 444 mus::mojom::WindowManager::kPreferredSize_Property, status_size);
433 } 445 }
434 446
435 } // namespace sysui 447 } // namespace sysui
436 } // namespace ash 448 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/shelf_delegate_mus.h ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698