| 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/shelf_types.h" | 10 #include "ash/public/cpp/shelf_types.h" |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 485 |
| 486 void ShellSurface::SetTitle(const base::string16& title) { | 486 void ShellSurface::SetTitle(const base::string16& title) { |
| 487 TRACE_EVENT1("exo", "ShellSurface::SetTitle", "title", | 487 TRACE_EVENT1("exo", "ShellSurface::SetTitle", "title", |
| 488 base::UTF16ToUTF8(title)); | 488 base::UTF16ToUTF8(title)); |
| 489 | 489 |
| 490 title_ = title; | 490 title_ = title; |
| 491 if (widget_) | 491 if (widget_) |
| 492 widget_->UpdateWindowTitle(); | 492 widget_->UpdateWindowTitle(); |
| 493 } | 493 } |
| 494 | 494 |
| 495 void ShellSurface::SetIcon(const gfx::ImageSkia& icon) { |
| 496 TRACE_EVENT0("exo", "ShellSurface::SetIcon"); |
| 497 |
| 498 icon_ = icon; |
| 499 if (widget_) |
| 500 widget_->UpdateWindowIcon(); |
| 501 } |
| 502 |
| 495 void ShellSurface::SetSystemModal(bool system_modal) { | 503 void ShellSurface::SetSystemModal(bool system_modal) { |
| 496 // System modal container is used by clients to implement client side | 504 // System modal container is used by clients to implement client side |
| 497 // managed system modal dialogs using a single ShellSurface instance. | 505 // managed system modal dialogs using a single ShellSurface instance. |
| 498 // Hit-test region will be non-empty when at least one dialog exists on | 506 // Hit-test region will be non-empty when at least one dialog exists on |
| 499 // the client side. Here we detect the transition between no client side | 507 // the client side. Here we detect the transition between no client side |
| 500 // dialog and at least one dialog so activatable state is properly | 508 // dialog and at least one dialog so activatable state is properly |
| 501 // updated. | 509 // updated. |
| 502 if (container_ != ash::kShellWindowId_SystemModalContainer) { | 510 if (container_ != ash::kShellWindowId_SystemModalContainer) { |
| 503 LOG(ERROR) | 511 LOG(ERROR) |
| 504 << "Only a window in SystemModalContainer can change the modality"; | 512 << "Only a window in SystemModalContainer can change the modality"; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 } | 830 } |
| 823 | 831 |
| 824 bool ShellSurface::CanMinimize() const { | 832 bool ShellSurface::CanMinimize() const { |
| 825 return can_minimize_; | 833 return can_minimize_; |
| 826 } | 834 } |
| 827 | 835 |
| 828 base::string16 ShellSurface::GetWindowTitle() const { | 836 base::string16 ShellSurface::GetWindowTitle() const { |
| 829 return title_; | 837 return title_; |
| 830 } | 838 } |
| 831 | 839 |
| 840 gfx::ImageSkia ShellSurface::GetWindowIcon() { |
| 841 return icon_; |
| 842 } |
| 843 |
| 832 void ShellSurface::SaveWindowPlacement(const gfx::Rect& bounds, | 844 void ShellSurface::SaveWindowPlacement(const gfx::Rect& bounds, |
| 833 ui::WindowShowState show_state) { | 845 ui::WindowShowState show_state) { |
| 834 if (bounds_mode_ != BoundsMode::CLIENT) | 846 if (bounds_mode_ != BoundsMode::CLIENT) |
| 835 WidgetDelegate::SaveWindowPlacement(bounds, show_state); | 847 WidgetDelegate::SaveWindowPlacement(bounds, show_state); |
| 836 } | 848 } |
| 837 | 849 |
| 838 bool ShellSurface::GetSavedWindowPlacement( | 850 bool ShellSurface::GetSavedWindowPlacement( |
| 839 const views::Widget* widget, | 851 const views::Widget* widget, |
| 840 gfx::Rect* bounds, | 852 gfx::Rect* bounds, |
| 841 ui::WindowShowState* show_state) const { | 853 ui::WindowShowState* show_state) const { |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1677 gfx::Point ShellSurface::GetMouseLocation() const { | 1689 gfx::Point ShellSurface::GetMouseLocation() const { |
| 1678 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); | 1690 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); |
| 1679 gfx::Point location = | 1691 gfx::Point location = |
| 1680 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 1692 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
| 1681 aura::Window::ConvertPointToTarget( | 1693 aura::Window::ConvertPointToTarget( |
| 1682 root_window, widget_->GetNativeWindow()->parent(), &location); | 1694 root_window, widget_->GetNativeWindow()->parent(), &location); |
| 1683 return location; | 1695 return location; |
| 1684 } | 1696 } |
| 1685 | 1697 |
| 1686 } // namespace exo | 1698 } // namespace exo |
| OLD | NEW |