Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Side by Side Diff: components/exo/shell_surface.cc

Issue 2900783003: Handle app custom icon via aura::Window property. (Closed)
Patch Set: nits Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 void ShellSurface::SetTitle(const base::string16& title) { 476 void ShellSurface::SetTitle(const base::string16& title) {
477 TRACE_EVENT1("exo", "ShellSurface::SetTitle", "title", 477 TRACE_EVENT1("exo", "ShellSurface::SetTitle", "title",
478 base::UTF16ToUTF8(title)); 478 base::UTF16ToUTF8(title));
479 479
480 title_ = title; 480 title_ = title;
481 if (widget_) 481 if (widget_)
482 widget_->UpdateWindowTitle(); 482 widget_->UpdateWindowTitle();
483 } 483 }
484 484
485 void ShellSurface::SetIcon(const gfx::ImageSkia& icon) {
486 TRACE_EVENT0("exo", "ShellSurface::SetIcon");
487
488 icon_ = icon;
489 if (widget_)
490 widget_->UpdateWindowIcon();
491 }
492
485 void ShellSurface::SetSystemModal(bool system_modal) { 493 void ShellSurface::SetSystemModal(bool system_modal) {
486 // System modal container is used by clients to implement client side 494 // System modal container is used by clients to implement client side
487 // managed system modal dialogs using a single ShellSurface instance. 495 // managed system modal dialogs using a single ShellSurface instance.
488 // Hit-test region will be non-empty when at least one dialog exists on 496 // Hit-test region will be non-empty when at least one dialog exists on
489 // the client side. Here we detect the transition between no client side 497 // the client side. Here we detect the transition between no client side
490 // dialog and at least one dialog so activatable state is properly 498 // dialog and at least one dialog so activatable state is properly
491 // updated. 499 // updated.
492 if (container_ != ash::kShellWindowId_SystemModalContainer) { 500 if (container_ != ash::kShellWindowId_SystemModalContainer) {
493 LOG(ERROR) 501 LOG(ERROR)
494 << "Only a window in SystemModalContainer can change the modality"; 502 << "Only a window in SystemModalContainer can change the modality";
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } 820 }
813 821
814 bool ShellSurface::CanMinimize() const { 822 bool ShellSurface::CanMinimize() const {
815 return can_minimize_; 823 return can_minimize_;
816 } 824 }
817 825
818 base::string16 ShellSurface::GetWindowTitle() const { 826 base::string16 ShellSurface::GetWindowTitle() const {
819 return title_; 827 return title_;
820 } 828 }
821 829
830 gfx::ImageSkia ShellSurface::GetWindowIcon() {
831 return icon_;
832 }
833
822 void ShellSurface::SaveWindowPlacement(const gfx::Rect& bounds, 834 void ShellSurface::SaveWindowPlacement(const gfx::Rect& bounds,
823 ui::WindowShowState show_state) { 835 ui::WindowShowState show_state) {
824 if (bounds_mode_ != BoundsMode::CLIENT) 836 if (bounds_mode_ != BoundsMode::CLIENT)
825 WidgetDelegate::SaveWindowPlacement(bounds, show_state); 837 WidgetDelegate::SaveWindowPlacement(bounds, show_state);
826 } 838 }
827 839
828 bool ShellSurface::GetSavedWindowPlacement( 840 bool ShellSurface::GetSavedWindowPlacement(
829 const views::Widget* widget, 841 const views::Widget* widget,
830 gfx::Rect* bounds, 842 gfx::Rect* bounds,
831 ui::WindowShowState* show_state) const { 843 ui::WindowShowState* show_state) const {
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 gfx::Point ShellSurface::GetMouseLocation() const { 1680 gfx::Point ShellSurface::GetMouseLocation() const {
1669 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); 1681 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow();
1670 gfx::Point location = 1682 gfx::Point location =
1671 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); 1683 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot();
1672 aura::Window::ConvertPointToTarget( 1684 aura::Window::ConvertPointToTarget(
1673 root_window, widget_->GetNativeWindow()->parent(), &location); 1685 root_window, widget_->GetNativeWindow()->parent(), &location);
1674 return location; 1686 return location;
1675 } 1687 }
1676 1688
1677 } // namespace exo 1689 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698