Chromium Code Reviews| 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 const ash::ShelfID shelf_id(id); | 558 window->SetProperty(aura::client::kAppIdKey, new std::string(id)); |
|
msw
2017/05/16 17:00:06
As this is the only place using kAppIdKey, it shou
msw
2017/05/16 17:03:27
And perhaps renaming the property to disambiguate
yawano
2017/05/17 08:36:49
Done. Renamed to kExoAppIdKey as oshima has sugges
| |
| 559 window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize())); | |
| 560 } | 559 } |
| 561 | 560 |
| 562 // static | 561 // static |
| 563 const std::string ShellSurface::GetApplicationId(aura::Window* window) { | 562 const std::string ShellSurface::GetApplicationId(aura::Window* window) { |
| 564 return ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey)) | 563 std::string* string_ptr = window->GetProperty(aura::client::kAppIdKey); |
| 565 .app_id; | 564 return string_ptr ? *string_ptr : std::string(); |
| 566 } | 565 } |
| 567 | 566 |
| 568 void ShellSurface::SetApplicationId(const std::string& application_id) { | 567 void ShellSurface::SetApplicationId(const std::string& application_id) { |
| 569 // Store the value in |application_id_| in case the window does not exist yet. | 568 // Store the value in |application_id_| in case the window does not exist yet. |
| 570 application_id_ = application_id; | 569 application_id_ = application_id; |
| 571 if (widget_ && widget_->GetNativeWindow()) | 570 if (widget_ && widget_->GetNativeWindow()) |
| 572 SetApplicationId(widget_->GetNativeWindow(), application_id); | 571 SetApplicationId(widget_->GetNativeWindow(), application_id); |
| 573 } | 572 } |
| 574 | 573 |
| 575 void ShellSurface::Move() { | 574 void ShellSurface::Move() { |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1737 gfx::Point ShellSurface::GetMouseLocation() const { | 1736 gfx::Point ShellSurface::GetMouseLocation() const { |
| 1738 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); | 1737 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); |
| 1739 gfx::Point location = | 1738 gfx::Point location = |
| 1740 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 1739 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
| 1741 aura::Window::ConvertPointToTarget( | 1740 aura::Window::ConvertPointToTarget( |
| 1742 root_window, widget_->GetNativeWindow()->parent(), &location); | 1741 root_window, widget_->GetNativeWindow()->parent(), &location); |
| 1743 return location; | 1742 return location; |
| 1744 } | 1743 } |
| 1745 | 1744 |
| 1746 } // namespace exo | 1745 } // namespace exo |
| OLD | NEW |