| 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/stacking_client.h" | 17 #include "ui/aura/client/stacking_client.h" |
| 18 #include "ui/aura/desktop_host.h" | 18 #include "ui/aura/desktop_host.h" |
| 19 #include "ui/aura/desktop_observer.h" | 19 #include "ui/aura/desktop_observer.h" |
| 20 #include "ui/aura/event.h" | 20 #include "ui/aura/event.h" |
| 21 #include "ui/aura/event_filter.h" | 21 #include "ui/aura/event_filter.h" |
| 22 #include "ui/aura/focus_manager.h" | 22 #include "ui/aura/focus_manager.h" |
| 23 #include "ui/aura/screen_aura.h" | 23 #include "ui/aura/screen_aura.h" |
| 24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_delegate.h" | 25 #include "ui/aura/window_delegate.h" |
| 26 #include "ui/base/hit_test.h" | 26 #include "ui/base/hit_test.h" |
| 27 #include "ui/base/ime/input_method.h" |
| 27 #include "ui/gfx/compositor/compositor.h" | 28 #include "ui/gfx/compositor/compositor.h" |
| 28 #include "ui/gfx/compositor/layer.h" | 29 #include "ui/gfx/compositor/layer.h" |
| 29 #include "ui/gfx/compositor/layer_animation_sequence.h" | 30 #include "ui/gfx/compositor/layer_animation_sequence.h" |
| 30 #include "ui/gfx/compositor/layer_animator.h" | 31 #include "ui/gfx/compositor/layer_animator.h" |
| 31 #include "ui/gfx/compositor/screen_rotation.h" | 32 #include "ui/gfx/compositor/screen_rotation.h" |
| 32 #include "ui/gfx/interpolated_transform.h" | 33 #include "ui/gfx/interpolated_transform.h" |
| 33 | 34 |
| 34 using std::string; | 35 using std::string; |
| 35 using std::vector; | 36 using std::vector; |
| 36 | 37 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 Window* Desktop::GetFocusedWindow() { | 581 Window* Desktop::GetFocusedWindow() { |
| 581 return focused_window_; | 582 return focused_window_; |
| 582 } | 583 } |
| 583 | 584 |
| 584 bool Desktop::IsFocusedWindow(const Window* window) const { | 585 bool Desktop::IsFocusedWindow(const Window* window) const { |
| 585 return focused_window_ == window; | 586 return focused_window_ == window; |
| 586 } | 587 } |
| 587 | 588 |
| 588 void Desktop::Init() { | 589 void Desktop::Init() { |
| 589 Window::Init(ui::Layer::LAYER_HAS_NO_TEXTURE); | 590 Window::Init(ui::Layer::LAYER_HAS_NO_TEXTURE); |
| 591 GetInputMethod()->Init(); |
| 590 SetBounds(gfx::Rect(host_->GetSize())); | 592 SetBounds(gfx::Rect(host_->GetSize())); |
| 591 Show(); | 593 Show(); |
| 592 compositor()->SetRootLayer(layer()); | 594 compositor()->SetRootLayer(layer()); |
| 593 } | 595 } |
| 594 | 596 |
| 595 gfx::Rect Desktop::GetInitialHostWindowBounds() const { | 597 gfx::Rect Desktop::GetInitialHostWindowBounds() const { |
| 596 gfx::Rect bounds(kDefaultHostWindowX, kDefaultHostWindowY, | 598 gfx::Rect bounds(kDefaultHostWindowX, kDefaultHostWindowY, |
| 597 kDefaultHostWindowWidth, kDefaultHostWindowHeight); | 599 kDefaultHostWindowWidth, kDefaultHostWindowHeight); |
| 598 | 600 |
| 599 const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 601 const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 600 switches::kAuraHostWindowSize); | 602 switches::kAuraHostWindowSize); |
| 601 vector<string> parts; | 603 vector<string> parts; |
| 602 base::SplitString(size_str, 'x', &parts); | 604 base::SplitString(size_str, 'x', &parts); |
| 603 int parsed_width = 0, parsed_height = 0; | 605 int parsed_width = 0, parsed_height = 0; |
| 604 if (parts.size() == 2 && | 606 if (parts.size() == 2 && |
| 605 base::StringToInt(parts[0], &parsed_width) && parsed_width > 0 && | 607 base::StringToInt(parts[0], &parsed_width) && parsed_width > 0 && |
| 606 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { | 608 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { |
| 607 bounds.set_size(gfx::Size(parsed_width, parsed_height)); | 609 bounds.set_size(gfx::Size(parsed_width, parsed_height)); |
| 608 } else if (use_fullscreen_host_window_) { | 610 } else if (use_fullscreen_host_window_) { |
| 609 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); | 611 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); |
| 610 } | 612 } |
| 611 | 613 |
| 612 return bounds; | 614 return bounds; |
| 613 } | 615 } |
| 614 | 616 |
| 617 ui::InputMethod* Desktop::GetInputMethod() { |
| 618 return host_->GetInputMethod(); |
| 619 } |
| 620 |
| 615 } // namespace aura | 621 } // namespace aura |
| OLD | NEW |