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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 434343004: Call OnNativeWindowChanged after maximizing and restoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 4 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
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 window_->SetProperty(aura::client::kCanResizeKey, 150 window_->SetProperty(aura::client::kCanResizeKey,
151 GetWidget()->widget_delegate()->CanResize()); 151 GetWidget()->widget_delegate()->CanResize());
152 152
153 if (parent) { 153 if (parent) {
154 parent->AddChild(window_); 154 parent->AddChild(window_);
155 } else { 155 } else {
156 aura::client::ParentWindowWithContext( 156 aura::client::ParentWindowWithContext(
157 window_, context->GetRootWindow(), window_bounds); 157 window_, context->GetRootWindow(), window_bounds);
158 } 158 }
159 159
160 // Start observing property changes.
161 window_->AddObserver(this);
162
160 // Wait to set the bounds until we have a parent. That way we can know our 163 // Wait to set the bounds until we have a parent. That way we can know our
161 // true state/bounds (the LayoutManager may enforce a particular 164 // true state/bounds (the LayoutManager may enforce a particular
162 // state/bounds). 165 // state/bounds).
163 if (IsMaximized()) 166 if (IsMaximized())
164 SetRestoreBounds(window_, window_bounds); 167 SetRestoreBounds(window_, window_bounds);
165 else 168 else
166 SetBounds(window_bounds); 169 SetBounds(window_bounds);
167 window_->set_ignore_events(!params.accept_events); 170 window_->set_ignore_events(!params.accept_events);
168 DCHECK(GetWidget()->GetRootView()); 171 DCHECK(GetWidget()->GetRootView());
169 if (params.type != Widget::InitParams::TYPE_TOOLTIP) 172 if (params.type != Widget::InitParams::TYPE_TOOLTIP)
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 794
792 void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) { 795 void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) {
793 delegate_->OnNativeWidgetPaint(canvas); 796 delegate_->OnNativeWidgetPaint(canvas);
794 } 797 }
795 798
796 void NativeWidgetAura::OnDeviceScaleFactorChanged(float device_scale_factor) { 799 void NativeWidgetAura::OnDeviceScaleFactorChanged(float device_scale_factor) {
797 // Repainting with new scale factor will paint the content at the right scale. 800 // Repainting with new scale factor will paint the content at the right scale.
798 } 801 }
799 802
800 void NativeWidgetAura::OnWindowDestroying(aura::Window* window) { 803 void NativeWidgetAura::OnWindowDestroying(aura::Window* window) {
804 window_->RemoveObserver(this);
801 delegate_->OnNativeWidgetDestroying(); 805 delegate_->OnNativeWidgetDestroying();
802 806
803 // If the aura::Window is destroyed, we can no longer show tooltips. 807 // If the aura::Window is destroyed, we can no longer show tooltips.
804 tooltip_manager_.reset(); 808 tooltip_manager_.reset();
805 } 809 }
806 810
807 void NativeWidgetAura::OnWindowDestroyed(aura::Window* window) { 811 void NativeWidgetAura::OnWindowDestroyed(aura::Window* window) {
808 window_ = NULL; 812 window_ = NULL;
809 delegate_->OnNativeWidgetDestroyed(); 813 delegate_->OnNativeWidgetDestroyed();
810 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) 814 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
811 delete this; 815 delete this;
812 } 816 }
813 817
814 void NativeWidgetAura::OnWindowTargetVisibilityChanged(bool visible) { 818 void NativeWidgetAura::OnWindowTargetVisibilityChanged(bool visible) {
815 delegate_->OnNativeWidgetVisibilityChanged(visible); 819 delegate_->OnNativeWidgetVisibilityChanged(visible);
816 } 820 }
817 821
818 bool NativeWidgetAura::HasHitTestMask() const { 822 bool NativeWidgetAura::HasHitTestMask() const {
819 return delegate_->HasHitTestMask(); 823 return delegate_->HasHitTestMask();
820 } 824 }
821 825
822 void NativeWidgetAura::GetHitTestMask(gfx::Path* mask) const { 826 void NativeWidgetAura::GetHitTestMask(gfx::Path* mask) const {
823 DCHECK(mask); 827 DCHECK(mask);
824 delegate_->GetHitTestMask(mask); 828 delegate_->GetHitTestMask(mask);
825 } 829 }
826 830
827 //////////////////////////////////////////////////////////////////////////////// 831 ////////////////////////////////////////////////////////////////////////////////
832 // NativeWidgetAura, aura::WindowObserver implementation:
833
834 void NativeWidgetAura::OnWindowPropertyChanged(aura::Window* window,
835 const void* key,
836 intptr_t old) {
837 if (key == aura::client::kShowStateKey)
838 delegate_->OnNativeWidgetWindowShowStateChanged();
839 }
840
841 ////////////////////////////////////////////////////////////////////////////////
828 // NativeWidgetAura, ui::EventHandler implementation: 842 // NativeWidgetAura, ui::EventHandler implementation:
829 843
830 void NativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) { 844 void NativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) {
831 DCHECK(window_); 845 DCHECK(window_);
832 if (event->is_char()) { 846 if (event->is_char()) {
833 // If a ui::InputMethod object is attached to the root window, character 847 // If a ui::InputMethod object is attached to the root window, character
834 // events are handled inside the object and are not passed to this function. 848 // events are handled inside the object and are not passed to this function.
835 // If such object is not attached, character events might be sent (e.g. on 849 // If such object is not attached, character events might be sent (e.g. on
836 // Windows). In this case, we just skip these. 850 // Windows). In this case, we just skip these.
837 return; 851 return;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1166 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1153 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1167 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1154 return gfx::FontList(gfx::Font(caption_font)); 1168 return gfx::FontList(gfx::Font(caption_font));
1155 #else 1169 #else
1156 return gfx::FontList(); 1170 return gfx::FontList();
1157 #endif 1171 #endif
1158 } 1172 }
1159 1173
1160 } // namespace internal 1174 } // namespace internal
1161 } // namespace views 1175 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698