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

Side by Side Diff: chrome/browser/ui/ash/multi_user_window_manager.cc

Issue 55303003: Fixing drag and drop visibility issues of tabs on a visiting desktop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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 "chrome/browser/ui/ash/multi_user_window_manager.h" 5 #include "chrome/browser/ui/ash/multi_user_window_manager.h"
6 6
7 #include "apps/shell_window.h" 7 #include "apps/shell_window.h"
8 #include "apps/shell_window_registry.h" 8 #include "apps/shell_window_registry.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/session_state_delegate.h" 10 #include "ash/session_state_delegate.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void MultiUserWindowManager::SetWindowOwner(aura::Window* window, 161 void MultiUserWindowManager::SetWindowOwner(aura::Window* window,
162 const std::string& user_id) { 162 const std::string& user_id) {
163 // Make sure the window is valid and there was no owner yet. 163 // Make sure the window is valid and there was no owner yet.
164 DCHECK(window); 164 DCHECK(window);
165 DCHECK(!user_id.empty()); 165 DCHECK(!user_id.empty());
166 if (GetWindowOwner(window) == user_id) 166 if (GetWindowOwner(window) == user_id)
167 return; 167 return;
168 DCHECK(GetWindowOwner(window).empty()); 168 DCHECK(GetWindowOwner(window).empty());
169 window_to_entry_[window] = new WindowEntry(user_id); 169 window_to_entry_[window] = new WindowEntry(user_id);
170 170
171 // Remember the initial visibility of the window.
172 window_to_entry_[window]->set_show(window->IsVisible());
173
171 // Set the window and the state observer. 174 // Set the window and the state observer.
172 window->AddObserver(this); 175 window->AddObserver(this);
173 ash::wm::GetWindowState(window)->AddObserver(this); 176 ash::wm::GetWindowState(window)->AddObserver(this);
174 177
175 // Add all transient children to our set of windows. Note that the function 178 // Add all transient children to our set of windows. Note that the function
176 // will add the children but not the owner to the transient children map. 179 // will add the children but not the owner to the transient children map.
177 AddTransientOwnerRecursive(window, window); 180 AddTransientOwnerRecursive(window, window);
178 181
179 if (user_id != current_user_id_) 182 if (user_id != current_user_id_)
180 SetWindowVisibility(window, false); 183 SetWindowVisibility(window, false);
(...skipping 15 matching lines...) Expand all
196 return; 199 return;
197 200
198 // Check that we are not trying to transfer ownership of a minimized window. 201 // Check that we are not trying to transfer ownership of a minimized window.
199 if (user_id != owner && ash::wm::GetWindowState(window)->IsMinimized()) 202 if (user_id != owner && ash::wm::GetWindowState(window)->IsMinimized())
200 return; 203 return;
201 204
202 WindowToEntryMap::iterator it = window_to_entry_.find(window); 205 WindowToEntryMap::iterator it = window_to_entry_.find(window);
203 it->second->set_show_for_user(user_id); 206 it->second->set_show_for_user(user_id);
204 207
205 // Show the window if the added user is the current one. 208 // Show the window if the added user is the current one.
206 if (user_id == current_user_id_) 209 if (user_id == current_user_id_) {
207 SetWindowVisibility(window, true); 210 // Only show the window if it should be shown according to its state.
208 else 211 if (it->second->show())
212 SetWindowVisibility(window, true);
213 } else {
209 SetWindowVisibility(window, false); 214 SetWindowVisibility(window, false);
215 }
210 } 216 }
211 217
212 bool MultiUserWindowManager::AreWindowsSharedAmongUsers() { 218 bool MultiUserWindowManager::AreWindowsSharedAmongUsers() {
213 WindowToEntryMap::iterator it = window_to_entry_.begin(); 219 WindowToEntryMap::iterator it = window_to_entry_.begin();
214 for (; it != window_to_entry_.end(); ++it) { 220 for (; it != window_to_entry_.end(); ++it) {
215 if (it->second->owner() != it->second->show_for_user()) 221 if (it->second->owner() != it->second->show_for_user())
216 return true; 222 return true;
217 } 223 }
218 return false; 224 return false;
219 } 225 }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 // To prevent these commands from being recorded as any other commands, we 574 // To prevent these commands from being recorded as any other commands, we
569 // are suppressing any window entry changes while this is going on. 575 // are suppressing any window entry changes while this is going on.
570 // Instead of calling SetWindowVisible, only show gets called here since all 576 // Instead of calling SetWindowVisible, only show gets called here since all
571 // dependents have been shown previously already. 577 // dependents have been shown previously already.
572 base::AutoReset<bool> suppressor(&suppress_visibility_changes_, true); 578 base::AutoReset<bool> suppressor(&suppress_visibility_changes_, true);
573 window->Show(); 579 window->Show();
574 } 580 }
575 } 581 }
576 582
577 } // namespace chrome 583 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698