| 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/constrained_window_views.h" | 5 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 ConstrainedWindowFrameView(views::Widget* container, | 248 ConstrainedWindowFrameView(views::Widget* container, |
| 249 bool browser_is_off_the_record); | 249 bool browser_is_off_the_record); |
| 250 virtual ~ConstrainedWindowFrameView(); | 250 virtual ~ConstrainedWindowFrameView(); |
| 251 | 251 |
| 252 virtual void UpdateWindowTitle() OVERRIDE; | 252 virtual void UpdateWindowTitle() OVERRIDE; |
| 253 | 253 |
| 254 // Overridden from views::NonClientFrameView: | 254 // Overridden from views::NonClientFrameView: |
| 255 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 255 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
| 256 virtual gfx::Rect GetWindowBoundsForClientBounds( | 256 virtual gfx::Rect GetWindowBoundsForClientBounds( |
| 257 const gfx::Rect& client_bounds) const OVERRIDE; | 257 const gfx::Rect& client_bounds) const OVERRIDE; |
| 258 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 258 virtual int NonClientHitTest(const gfx::Point& point) const OVERRIDE; |
| 259 virtual void GetWindowMask(const gfx::Size& size, | 259 virtual void GetWindowMask(const gfx::Size& size, |
| 260 gfx::Path* window_mask) OVERRIDE; | 260 gfx::Path* window_mask) OVERRIDE; |
| 261 virtual void ResetWindowControls() OVERRIDE {} | 261 virtual void ResetWindowControls() OVERRIDE {} |
| 262 virtual void UpdateWindowIcon() OVERRIDE {} | 262 virtual void UpdateWindowIcon() OVERRIDE {} |
| 263 | 263 |
| 264 // Overridden from views::View: | 264 // Overridden from views::View: |
| 265 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 265 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 266 virtual void Layout() OVERRIDE; | 266 virtual void Layout() OVERRIDE; |
| 267 virtual void OnThemeChanged() OVERRIDE; | 267 virtual void OnThemeChanged() OVERRIDE; |
| 268 | 268 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 gfx::Rect ConstrainedWindowFrameView::GetWindowBoundsForClientBounds( | 404 gfx::Rect ConstrainedWindowFrameView::GetWindowBoundsForClientBounds( |
| 405 const gfx::Rect& client_bounds) const { | 405 const gfx::Rect& client_bounds) const { |
| 406 int top_height = NonClientTopBorderHeight(); | 406 int top_height = NonClientTopBorderHeight(); |
| 407 int border_thickness = NonClientBorderThickness(); | 407 int border_thickness = NonClientBorderThickness(); |
| 408 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), | 408 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), |
| 409 std::max(0, client_bounds.y() - top_height), | 409 std::max(0, client_bounds.y() - top_height), |
| 410 client_bounds.width() + (2 * border_thickness), | 410 client_bounds.width() + (2 * border_thickness), |
| 411 client_bounds.height() + top_height + border_thickness); | 411 client_bounds.height() + top_height + border_thickness); |
| 412 } | 412 } |
| 413 | 413 |
| 414 int ConstrainedWindowFrameView::NonClientHitTest(const gfx::Point& point) { | 414 int ConstrainedWindowFrameView::NonClientHitTest( |
| 415 const gfx::Point& point) const { |
| 415 if (!bounds().Contains(point)) | 416 if (!bounds().Contains(point)) |
| 416 return HTNOWHERE; | 417 return HTNOWHERE; |
| 417 | 418 |
| 418 int frame_component = | 419 int frame_component = |
| 419 container_->client_view()->NonClientHitTest(point); | 420 container_->client_view()->NonClientHitTest(point); |
| 420 | 421 |
| 421 // See if we're in the sysmenu region. (We check the ClientView first to be | 422 // See if we're in the sysmenu region. (We check the ClientView first to be |
| 422 // consistent with OpaqueBrowserFrameView; it's not really necessary here.) | 423 // consistent with OpaqueBrowserFrameView; it's not really necessary here.) |
| 423 gfx::Rect sysmenu_rect(IconBounds()); | 424 gfx::Rect sysmenu_rect(IconBounds()); |
| 424 sysmenu_rect.set_x(GetMirroredXForRect(sysmenu_rect)); | 425 sysmenu_rect.set_x(GetMirroredXForRect(sysmenu_rect)); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 force_opaque_border); | 721 force_opaque_border); |
| 721 } | 722 } |
| 722 #if defined(USE_ASH) | 723 #if defined(USE_ASH) |
| 723 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; | 724 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; |
| 724 frame->Init(widget); | 725 frame->Init(widget); |
| 725 return frame; | 726 return frame; |
| 726 #endif | 727 #endif |
| 727 return new ConstrainedWindowFrameView(widget, | 728 return new ConstrainedWindowFrameView(widget, |
| 728 browser_context->IsOffTheRecord()); | 729 browser_context->IsOffTheRecord()); |
| 729 } | 730 } |
| OLD | NEW |