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

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 2597733002: [views] Makes DesktopWindowTreeHostX11::FrameTypeChanged use PostTask (Closed)
Patch Set: [views] Makes DesktopWindowTreeHostX11::FrameTypeChanged use PostTask (nits) Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index 132cfa752546c0359294c145c05efe7c902d8986..cfc4f0d6f8c37cf2da4e63a17ef5495930eb79f1 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -1027,12 +1027,15 @@ void DesktopWindowTreeHostX11::FrameTypeChanged() {
// and does not change.
return;
}
-
- SetUseNativeFrame(new_type == Widget::FRAME_TYPE_FORCE_NATIVE);
- // Replace the frame and layout the contents. Even though we don't have a
- // swapable glass frame like on Windows, we still replace the frame because
- // the button assets don't update otherwise.
- native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame();
+ // Avoid mutating |View::children_| while possibly iterating over them.
+ // See View::PropagateNativeThemeChanged().
+ // TODO(varkha, sadrul): Investigate removing this (and instead expecting the
+ // NonClientView::UpdateFrame() to update the frame-view when theme changes,
+ // like all other views).
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&DesktopWindowTreeHostX11::DelayedChangeFrameType,
+ weak_factory_.GetWeakPtr(),
+ new_type));
}
void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) {
@@ -2279,6 +2282,14 @@ void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size_in_pixels) {
delayed_resize_task_.Cancel();
}
+void DesktopWindowTreeHostX11::DelayedChangeFrameType(Widget::FrameType type) {
+ SetUseNativeFrame(type == Widget::FRAME_TYPE_FORCE_NATIVE);
+ // Replace the frame and layout the contents. Even though we don't have a
+ // swappable glass frame like on Windows, we still replace the frame because
+ // the button assets don't update otherwise.
+ native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame();
+}
+
gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInPixels() const {
std::vector<int> value;
if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) &&
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698