OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura/desktop.h" | 5 #include "ui/aura/desktop.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // The layer, and all the observers should be notified of the | 316 // The layer, and all the observers should be notified of the |
317 // transformed size of the desktop. | 317 // transformed size of the desktop. |
318 gfx::Rect bounds(size); | 318 gfx::Rect bounds(size); |
319 layer()->transform().TransformRect(&bounds); | 319 layer()->transform().TransformRect(&bounds); |
320 SetBounds(gfx::Rect(bounds.size())); | 320 SetBounds(gfx::Rect(bounds.size())); |
321 FOR_EACH_OBSERVER(DesktopObserver, observers_, | 321 FOR_EACH_OBSERVER(DesktopObserver, observers_, |
322 OnDesktopResized(bounds.size())); | 322 OnDesktopResized(bounds.size())); |
323 } | 323 } |
324 | 324 |
325 void Desktop::SetActiveWindow(Window* window, Window* to_focus) { | 325 void Desktop::SetActiveWindow(Window* window, Window* to_focus) { |
326 if (!window) | |
327 return; | |
328 // The stacking client may impose rules on what window configurations can be | 326 // The stacking client may impose rules on what window configurations can be |
329 // activated or deactivated. | 327 // activated or deactivated. |
330 if (!stacking_client_->CanActivateWindow(window)) | 328 if (window && !stacking_client_->CanActivateWindow(window)) |
331 return; | 329 return; |
332 // The window may not be activate-able. | 330 // The window may not be activate-able. |
333 if (!window->CanActivate()) | 331 if (window && !window->CanActivate()) |
334 return; | 332 return; |
335 // Nothing may actually have changed. | 333 // Nothing may actually have changed. |
336 if (active_window_ == window) | 334 if (active_window_ == window) |
337 return; | 335 return; |
338 | 336 |
339 Window* old_active = active_window_; | 337 Window* old_active = active_window_; |
340 active_window_ = window; | 338 active_window_ = window; |
341 // Invoke OnLostActive after we've changed the active window. That way if the | 339 // Invoke OnLostActive after we've changed the active window. That way if the |
342 // delegate queries for active state it doesn't think the window is still | 340 // delegate queries for active state it doesn't think the window is still |
343 // active. | 341 // active. |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { | 604 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { |
607 bounds.set_size(gfx::Size(parsed_width, parsed_height)); | 605 bounds.set_size(gfx::Size(parsed_width, parsed_height)); |
608 } else if (use_fullscreen_host_window_) { | 606 } else if (use_fullscreen_host_window_) { |
609 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); | 607 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); |
610 } | 608 } |
611 | 609 |
612 return bounds; | 610 return bounds; |
613 } | 611 } |
614 | 612 |
615 } // namespace aura | 613 } // namespace aura |
OLD | NEW |