Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/browser/ui/views/frame/app_non_client_frame_view_aura.h" | 5 #include "chrome/browser/ui/views/frame/app_non_client_frame_view_aura.h" |
| 6 | 6 |
| 7 #include "base/debug/stack_trace.h" | 7 #include "base/debug/stack_trace.h" |
| 8 #include "chrome/browser/ui/views/frame/browser_frame.h" | 8 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 10 #include "grit/ash_resources.h" | 10 #include "grit/ash_resources.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 void AppNonClientFrameViewAura::OnBoundsChanged( | 243 void AppNonClientFrameViewAura::OnBoundsChanged( |
| 244 const gfx::Rect& previous_bounds) { | 244 const gfx::Rect& previous_bounds) { |
| 245 if (control_widget_) | 245 if (control_widget_) |
| 246 control_widget_->GetNativeView()->SetBounds(GetControlBounds()); | 246 control_widget_->GetNativeView()->SetBounds(GetControlBounds()); |
| 247 } | 247 } |
| 248 | 248 |
| 249 gfx::Rect AppNonClientFrameViewAura::GetControlBounds() const { | 249 gfx::Rect AppNonClientFrameViewAura::GetControlBounds() const { |
| 250 if (!control_view_) | 250 if (!control_view_) |
| 251 return gfx::Rect(); | 251 return gfx::Rect(); |
| 252 gfx::Size preferred = control_view_->GetPreferredSize(); | 252 gfx::Size preferred = control_view_->GetPreferredSize(); |
| 253 gfx::Point location(width() - preferred.width(), 0); | 253 const gfx::Rect bounds = |
| 254 ConvertPointToWidget(this, &location); | 254 control_widget_->GetTopLevelWidgetForNativeView( |
| 255 control_widget_->GetNativeWindow())->GetWindowBoundsInScreen(); | |
| 256 // Position it flush to the right side of the (parent) widget. | |
| 257 gfx::Point location(bounds.width() - preferred.width(), 0); | |
|
sky
2012/09/24 21:24:16
control_widget_ is a child widget of the browser.
Mr4D (OOO till 08-26)
2012/09/25 14:23:50
Well - in the case I have seen (and I can reproduc
| |
| 255 return gfx::Rect( | 258 return gfx::Rect( |
| 256 location.x(), location.y(), | 259 location.x(), location.y(), |
| 257 preferred.width(), preferred.height()); | 260 preferred.width(), preferred.height()); |
| 258 } | 261 } |
| 259 | 262 |
| 260 void AppNonClientFrameViewAura::CloseControlWidget() { | 263 void AppNonClientFrameViewAura::CloseControlWidget() { |
| 261 if (control_widget_) { | 264 if (control_widget_) { |
| 262 control_widget_->Close(); | 265 control_widget_->Close(); |
| 263 control_widget_ = NULL; | 266 control_widget_ = NULL; |
| 264 } | 267 } |
| 265 } | 268 } |
| OLD | NEW |