| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/frame/custom_frame_view_ash.h" | 9 #include "ash/frame/custom_frame_view_ash.h" |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 DCHECK_EQ(container_, ash::kShellWindowId_SystemModalContainer); | 548 DCHECK_EQ(container_, ash::kShellWindowId_SystemModalContainer); |
| 549 widget_->GetNativeWindow()->SetProperty( | 549 widget_->GetNativeWindow()->SetProperty( |
| 550 aura::client::kModalKey, | 550 aura::client::kModalKey, |
| 551 system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); | 551 system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); |
| 552 } | 552 } |
| 553 | 553 |
| 554 // static | 554 // static |
| 555 void ShellSurface::SetApplicationId(aura::Window* window, | 555 void ShellSurface::SetApplicationId(aura::Window* window, |
| 556 const std::string& id) { | 556 const std::string& id) { |
| 557 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id); | 557 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id); |
| 558 window->SetProperty(ash::kShelfIDKey, new ash::ShelfID(id)); | 558 const ash::ShelfID shelf_id(id); |
| 559 window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize())); |
| 559 } | 560 } |
| 560 | 561 |
| 561 // static | 562 // static |
| 562 const std::string ShellSurface::GetApplicationId(aura::Window* window) { | 563 const std::string ShellSurface::GetApplicationId(aura::Window* window) { |
| 563 ash::ShelfID* shelf_id = window->GetProperty(ash::kShelfIDKey); | 564 return ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey)) |
| 564 return shelf_id ? shelf_id->app_id : std::string(); | 565 .app_id; |
| 565 } | 566 } |
| 566 | 567 |
| 567 void ShellSurface::SetApplicationId(const std::string& application_id) { | 568 void ShellSurface::SetApplicationId(const std::string& application_id) { |
| 568 // Store the value in |application_id_| in case the window does not exist yet. | 569 // Store the value in |application_id_| in case the window does not exist yet. |
| 569 application_id_ = application_id; | 570 application_id_ = application_id; |
| 570 if (widget_ && widget_->GetNativeWindow()) | 571 if (widget_ && widget_->GetNativeWindow()) |
| 571 SetApplicationId(widget_->GetNativeWindow(), application_id); | 572 SetApplicationId(widget_->GetNativeWindow(), application_id); |
| 572 } | 573 } |
| 573 | 574 |
| 574 void ShellSurface::Move() { | 575 void ShellSurface::Move() { |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 gfx::Point ShellSurface::GetMouseLocation() const { | 1737 gfx::Point ShellSurface::GetMouseLocation() const { |
| 1737 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); | 1738 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); |
| 1738 gfx::Point location = | 1739 gfx::Point location = |
| 1739 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 1740 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
| 1740 aura::Window::ConvertPointToTarget( | 1741 aura::Window::ConvertPointToTarget( |
| 1741 root_window, widget_->GetNativeWindow()->parent(), &location); | 1742 root_window, widget_->GetNativeWindow()->parent(), &location); |
| 1742 return location; | 1743 return location; |
| 1743 } | 1744 } |
| 1744 | 1745 |
| 1745 } // namespace exo | 1746 } // namespace exo |
| OLD | NEW |