| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/string_split.h" | 15 #include "base/string_split.h" |
| 16 #include "ui/aura/aura_switches.h" | 16 #include "ui/aura/aura_switches.h" |
| 17 #include "ui/aura/client/drag_drop_client.h" |
| 17 #include "ui/aura/client/stacking_client.h" | 18 #include "ui/aura/client/stacking_client.h" |
| 18 #include "ui/aura/desktop_host.h" | 19 #include "ui/aura/desktop_host.h" |
| 19 #include "ui/aura/desktop_observer.h" | 20 #include "ui/aura/desktop_observer.h" |
| 20 #include "ui/aura/event.h" | 21 #include "ui/aura/event.h" |
| 21 #include "ui/aura/event_filter.h" | 22 #include "ui/aura/event_filter.h" |
| 22 #include "ui/aura/focus_manager.h" | 23 #include "ui/aura/focus_manager.h" |
| 23 #include "ui/aura/screen_aura.h" | 24 #include "ui/aura/screen_aura.h" |
| 24 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_delegate.h" | 26 #include "ui/aura/window_delegate.h" |
| 26 #include "ui/base/hit_test.h" | 27 #include "ui/base/hit_test.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // static | 190 // static |
| 190 void Desktop::DeleteInstanceForTesting() { | 191 void Desktop::DeleteInstanceForTesting() { |
| 191 delete instance_; | 192 delete instance_; |
| 192 instance_ = NULL; | 193 instance_ = NULL; |
| 193 } | 194 } |
| 194 | 195 |
| 195 void Desktop::SetStackingClient(StackingClient* stacking_client) { | 196 void Desktop::SetStackingClient(StackingClient* stacking_client) { |
| 196 stacking_client_.reset(stacking_client); | 197 stacking_client_.reset(stacking_client); |
| 197 } | 198 } |
| 198 | 199 |
| 200 void Desktop::SetDragDropClient(DragDropClient* drag_drop_client) { |
| 201 drag_drop_client_.reset(drag_drop_client); |
| 202 } |
| 203 |
| 199 void Desktop::ShowDesktop() { | 204 void Desktop::ShowDesktop() { |
| 200 host_->Show(); | 205 host_->Show(); |
| 201 } | 206 } |
| 202 | 207 |
| 203 void Desktop::SetHostSize(const gfx::Size& size) { | 208 void Desktop::SetHostSize(const gfx::Size& size) { |
| 204 host_->SetSize(size); | 209 host_->SetSize(size); |
| 205 // Requery the location to constrain it within the new desktop size. | 210 // Requery the location to constrain it within the new desktop size. |
| 206 last_mouse_location_ = host_->QueryMouseLocation(); | 211 last_mouse_location_ = host_->QueryMouseLocation(); |
| 207 } | 212 } |
| 208 | 213 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 capture_window_ = window; | 409 capture_window_ = window; |
| 405 | 410 |
| 406 if (capture_window_) { | 411 if (capture_window_) { |
| 407 // Make all subsequent mouse events and touch go to the capture window. We | 412 // Make all subsequent mouse events and touch go to the capture window. We |
| 408 // shouldn't need to send an event here as OnCaptureLost should take care of | 413 // shouldn't need to send an event here as OnCaptureLost should take care of |
| 409 // that. | 414 // that. |
| 410 if (mouse_pressed_handler_) | 415 if (mouse_pressed_handler_) |
| 411 mouse_pressed_handler_ = capture_window_; | 416 mouse_pressed_handler_ = capture_window_; |
| 412 if (touch_event_handler_) | 417 if (touch_event_handler_) |
| 413 touch_event_handler_ = capture_window_; | 418 touch_event_handler_ = capture_window_; |
| 419 } else { |
| 420 // When capture is lost, we must reset the event handlers. |
| 421 mouse_pressed_handler_ = NULL; |
| 422 touch_event_handler_ = NULL; |
| 414 } | 423 } |
| 415 } | 424 } |
| 416 | 425 |
| 417 void Desktop::ReleaseCapture(Window* window) { | 426 void Desktop::ReleaseCapture(Window* window) { |
| 418 if (capture_window_ != window) | 427 if (capture_window_ != window) |
| 419 return; | 428 return; |
| 420 SetCapture(NULL); | 429 SetCapture(NULL); |
| 421 } | 430 } |
| 422 | 431 |
| 423 void Desktop::SetTransform(const ui::Transform& transform) { | 432 void Desktop::SetTransform(const ui::Transform& transform) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { | 597 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { |
| 589 bounds.set_size(gfx::Size(parsed_width, parsed_height)); | 598 bounds.set_size(gfx::Size(parsed_width, parsed_height)); |
| 590 } else if (use_fullscreen_host_window_) { | 599 } else if (use_fullscreen_host_window_) { |
| 591 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); | 600 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); |
| 592 } | 601 } |
| 593 | 602 |
| 594 return bounds; | 603 return bounds; |
| 595 } | 604 } |
| 596 | 605 |
| 597 } // namespace aura | 606 } // namespace aura |
| OLD | NEW |