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

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

Issue 2247503002: mash: Create and show a shelf in mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_window_watcher.h" 5 #include "ash/common/shelf/shelf_window_watcher.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/shelf/shelf_constants.h" 10 #include "ash/common/shelf/shelf_constants.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { 95 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) {
96 observed_container_windows_.Add( 96 observed_container_windows_.Add(
97 root->GetChildByShellWindowId(kShellWindowId_DefaultContainer)); 97 root->GetChildByShellWindowId(kShellWindowId_DefaultContainer));
98 } 98 }
99 99
100 display::Screen::GetScreen()->AddObserver(this); 100 display::Screen::GetScreen()->AddObserver(this);
101 } 101 }
102 102
103 ShelfWindowWatcher::~ShelfWindowWatcher() { 103 ShelfWindowWatcher::~ShelfWindowWatcher() {
104 display::Screen::GetScreen()->RemoveObserver(this); 104 display::Screen::GetScreen()->RemoveObserver(this);
105 WmShell::Get()->RemoveActivationObserver(this); 105 if (WmShell::HasInstance())
James Cook 2016/08/17 03:29:39 Why is this needed? ShelfWindowWatcher is owned by
msw 2016/08/17 17:45:44 Fixed instead by calling WmShell::Shutdown in Wind
106 WmShell::Get()->RemoveActivationObserver(this);
106 } 107 }
107 108
108 void ShelfWindowWatcher::AddShelfItem(WmWindow* window) { 109 void ShelfWindowWatcher::AddShelfItem(WmWindow* window) {
109 const ShelfItemDetails* item_details = window->GetShelfItemDetails(); 110 const ShelfItemDetails* item_details = window->GetShelfItemDetails();
110 ShelfItem item; 111 ShelfItem item;
111 ShelfID id = model_->next_id(); 112 ShelfID id = model_->next_id();
112 item.status = window->IsActive() ? STATUS_ACTIVE : STATUS_RUNNING; 113 item.status = window->IsActive() ? STATUS_ACTIVE : STATUS_RUNNING;
113 SetShelfItemDetailsForShelfItem(&item, *item_details); 114 SetShelfItemDetailsForShelfItem(&item, *item_details);
114 window->SetIntProperty(WmWindowProperty::SHELF_ID, id); 115 window->SetIntProperty(WmWindowProperty::SHELF_ID, id);
115 std::unique_ptr<ShelfItemDelegate> item_delegate( 116 std::unique_ptr<ShelfItemDelegate> item_delegate(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 observed_container_windows_.Add(container); 213 observed_container_windows_.Add(container);
213 } 214 }
214 215
215 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { 216 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) {
216 } 217 }
217 218
218 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, 219 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&,
219 uint32_t) {} 220 uint32_t) {}
220 221
221 } // namespace ash 222 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698