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

Side by Side Diff: ash/wm/frame_painter.cc

Issue 23496024: Introduce RootWindowProperty for RootWindow's properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/wm/frame_painter.h" 5 #include "ash/wm/frame_painter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/root_window_property.h"
11 #include "ash/shell.h" 12 #include "ash/shell.h"
12 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
13 #include "ash/wm/property_util.h" 14 #include "ash/wm/property_util.h"
14 #include "ash/wm/window_properties.h" 15 #include "ash/wm/window_properties.h"
15 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
16 #include "ash/wm/workspace/frame_caption_button_container_view.h" 17 #include "ash/wm/workspace/frame_caption_button_container_view.h"
17 #include "base/logging.h" // DCHECK 18 #include "base/logging.h" // DCHECK
18 #include "grit/ash_resources.h" 19 #include "grit/ash_resources.h"
19 #include "third_party/skia/include/core/SkCanvas.h" 20 #include "third_party/skia/include/core/SkCanvas.h"
20 #include "third_party/skia/include/core/SkColor.h" 21 #include "third_party/skia/include/core/SkColor.h"
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 749
749 bool FramePainter::UseSoloWindowHeader() const { 750 bool FramePainter::UseSoloWindowHeader() const {
750 // Don't use transparent headers for panels, pop-ups, etc. 751 // Don't use transparent headers for panels, pop-ups, etc.
751 if (!IsSoloWindowHeaderCandidate(window_)) 752 if (!IsSoloWindowHeaderCandidate(window_))
752 return false; 753 return false;
753 aura::RootWindow* root = window_->GetRootWindow(); 754 aura::RootWindow* root = window_->GetRootWindow();
754 if (!root || root->GetProperty(internal::kIgnoreSoloWindowFramePainterPolicy)) 755 if (!root || root->GetProperty(internal::kIgnoreSoloWindowFramePainterPolicy))
755 return false; 756 return false;
756 // Don't recompute every time, as it would require many window property 757 // Don't recompute every time, as it would require many window property
757 // lookups. 758 // lookups.
758 return root->GetProperty(internal::kSoloWindowHeaderKey); 759 return internal::GetRootWindowProperty(root)->solo_window_header;
759 } 760 }
760 761
761 // static 762 // static
762 bool FramePainter::UseSoloWindowHeaderInRoot(RootWindow* root_window, 763 bool FramePainter::UseSoloWindowHeaderInRoot(RootWindow* root_window,
763 Window* ignore_window) { 764 Window* ignore_window) {
764 int visible_window_count = 0; 765 int visible_window_count = 0;
765 std::vector<Window*> windows = GetWindowsForSoloHeaderUpdate(root_window); 766 std::vector<Window*> windows = GetWindowsForSoloHeaderUpdate(root_window);
766 for (std::vector<Window*>::const_iterator it = windows.begin(); 767 for (std::vector<Window*>::const_iterator it = windows.begin();
767 it != windows.end(); 768 it != windows.end();
768 ++it) { 769 ++it) {
(...skipping 18 matching lines...) Expand all
787 void FramePainter::UpdateSoloWindowInRoot(RootWindow* root, 788 void FramePainter::UpdateSoloWindowInRoot(RootWindow* root,
788 Window* ignore_window) { 789 Window* ignore_window) {
789 #if defined(OS_WIN) 790 #if defined(OS_WIN)
790 // Non-Ash Windows doesn't do solo-window counting for transparency effects, 791 // Non-Ash Windows doesn't do solo-window counting for transparency effects,
791 // as the desktop background and window frames are managed by the OS. 792 // as the desktop background and window frames are managed by the OS.
792 if (!ash::Shell::HasInstance()) 793 if (!ash::Shell::HasInstance())
793 return; 794 return;
794 #endif 795 #endif
795 if (!root) 796 if (!root)
796 return; 797 return;
797 bool old_solo_header = root->GetProperty(internal::kSoloWindowHeaderKey); 798 internal::RootWindowProperty* root_window_property =
799 internal::GetRootWindowProperty(root);
800 bool old_solo_header = root_window_property->solo_window_header;
798 bool new_solo_header = UseSoloWindowHeaderInRoot(root, ignore_window); 801 bool new_solo_header = UseSoloWindowHeaderInRoot(root, ignore_window);
799 if (old_solo_header == new_solo_header) 802 if (old_solo_header == new_solo_header)
800 return; 803 return;
801 root->SetProperty(internal::kSoloWindowHeaderKey, new_solo_header); 804 root_window_property->solo_window_header = new_solo_header;
805
802 // Invalidate all the window frames in the desktop. There should only be 806 // Invalidate all the window frames in the desktop. There should only be
803 // a few. 807 // a few.
804 std::vector<Window*> windows = GetWindowsForSoloHeaderUpdate(root); 808 std::vector<Window*> windows = GetWindowsForSoloHeaderUpdate(root);
805 for (std::vector<Window*>::const_iterator it = windows.begin(); 809 for (std::vector<Window*>::const_iterator it = windows.begin();
806 it != windows.end(); 810 it != windows.end();
807 ++it) { 811 ++it) {
808 Widget* widget = Widget::GetWidgetForNativeWindow(*it); 812 Widget* widget = Widget::GetWidgetForNativeWindow(*it);
809 if (widget && widget->non_client_view()) 813 if (widget && widget->non_client_view())
810 widget->non_client_view()->SchedulePaint(); 814 widget->non_client_view()->SchedulePaint();
811 } 815 }
(...skipping 14 matching lines...) Expand all
826 // icon. Don't use |window_icon_| for this computation as it may be NULL. 830 // icon. Don't use |window_icon_| for this computation as it may be NULL.
827 int title_y = GetCaptionButtonContainerCenterY() - title_font.GetHeight() / 2; 831 int title_y = GetCaptionButtonContainerCenterY() - title_font.GetHeight() / 2;
828 return gfx::Rect( 832 return gfx::Rect(
829 title_x, 833 title_x,
830 std::max(0, title_y), 834 std::max(0, title_y),
831 std::max(0, caption_button_container_->x() - kTitleLogoSpacing - title_x), 835 std::max(0, caption_button_container_->x() - kTitleLogoSpacing - title_x),
832 title_font.GetHeight()); 836 title_font.GetHeight());
833 } 837 }
834 838
835 } // namespace ash 839 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698