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

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

Issue 2900783003: Handle app custom icon via aura::Window property. (Closed)
Patch Set: nits, discard owner from _item_controller, make SetAppIcon non-static 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 return window->GetProperty(kApplicationIdKey); 524 return window->GetProperty(kApplicationIdKey);
525 } 525 }
526 526
527 void ShellSurface::SetApplicationId(const std::string& application_id) { 527 void ShellSurface::SetApplicationId(const std::string& application_id) {
528 // Store the value in |application_id_| in case the window does not exist yet. 528 // Store the value in |application_id_| in case the window does not exist yet.
529 application_id_ = application_id; 529 application_id_ = application_id;
530 if (widget_ && widget_->GetNativeWindow()) 530 if (widget_ && widget_->GetNativeWindow())
531 SetApplicationId(widget_->GetNativeWindow(), application_id); 531 SetApplicationId(widget_->GetNativeWindow(), application_id);
532 } 532 }
533 533
534 void ShellSurface::SetAppIcon(const gfx::ImageSkia& icon) {
535 icon_ = icon;
536 widget_->UpdateWindowIcon();
reveman 2017/06/01 22:05:36 nit: please leave this up to the caller so icon ca
khmel 2017/06/01 22:19:27 I did it the same way as SetTitle if (widget_)
reveman 2017/06/01 22:26:00 Sounds good. Thanks!
537 }
538
534 void ShellSurface::Move() { 539 void ShellSurface::Move() {
535 TRACE_EVENT0("exo", "ShellSurface::Move"); 540 TRACE_EVENT0("exo", "ShellSurface::Move");
536 541
537 if (!widget_) 542 if (!widget_)
538 return; 543 return;
539 544
540 switch (bounds_mode_) { 545 switch (bounds_mode_) {
541 case BoundsMode::SHELL: 546 case BoundsMode::SHELL:
542 case BoundsMode::CLIENT: 547 case BoundsMode::CLIENT:
543 AttemptToStartDrag(HTCAPTION); 548 AttemptToStartDrag(HTCAPTION);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } 817 }
813 818
814 bool ShellSurface::CanMinimize() const { 819 bool ShellSurface::CanMinimize() const {
815 return can_minimize_; 820 return can_minimize_;
816 } 821 }
817 822
818 base::string16 ShellSurface::GetWindowTitle() const { 823 base::string16 ShellSurface::GetWindowTitle() const {
819 return title_; 824 return title_;
820 } 825 }
821 826
827 gfx::ImageSkia ShellSurface::GetWindowIcon() {
828 return icon_;
829 }
830
822 void ShellSurface::SaveWindowPlacement(const gfx::Rect& bounds, 831 void ShellSurface::SaveWindowPlacement(const gfx::Rect& bounds,
823 ui::WindowShowState show_state) { 832 ui::WindowShowState show_state) {
824 if (bounds_mode_ != BoundsMode::CLIENT) 833 if (bounds_mode_ != BoundsMode::CLIENT)
825 WidgetDelegate::SaveWindowPlacement(bounds, show_state); 834 WidgetDelegate::SaveWindowPlacement(bounds, show_state);
826 } 835 }
827 836
828 bool ShellSurface::GetSavedWindowPlacement( 837 bool ShellSurface::GetSavedWindowPlacement(
829 const views::Widget* widget, 838 const views::Widget* widget,
830 gfx::Rect* bounds, 839 gfx::Rect* bounds,
831 ui::WindowShowState* show_state) const { 840 ui::WindowShowState* show_state) const {
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 gfx::Point ShellSurface::GetMouseLocation() const { 1677 gfx::Point ShellSurface::GetMouseLocation() const {
1669 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); 1678 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow();
1670 gfx::Point location = 1679 gfx::Point location =
1671 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); 1680 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot();
1672 aura::Window::ConvertPointToTarget( 1681 aura::Window::ConvertPointToTarget(
1673 root_window, widget_->GetNativeWindow()->parent(), &location); 1682 root_window, widget_->GetNativeWindow()->parent(), &location);
1674 return location; 1683 return location;
1675 } 1684 }
1676 1685
1677 } // namespace exo 1686 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698