| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 void UpdateWindowTitle(); | 158 void UpdateWindowTitle(); |
| 159 | 159 |
| 160 // Overridden from views::NonClientFrameView: | 160 // Overridden from views::NonClientFrameView: |
| 161 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 161 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
| 162 virtual gfx::Rect GetWindowBoundsForClientBounds( | 162 virtual gfx::Rect GetWindowBoundsForClientBounds( |
| 163 const gfx::Rect& client_bounds) const OVERRIDE; | 163 const gfx::Rect& client_bounds) const OVERRIDE; |
| 164 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 164 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; |
| 165 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) | 165 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) |
| 166 OVERRIDE; | 166 OVERRIDE; |
| 167 virtual void EnableClose(bool enable) OVERRIDE; |
| 167 virtual void ResetWindowControls() OVERRIDE {} | 168 virtual void ResetWindowControls() OVERRIDE {} |
| 168 virtual void UpdateWindowIcon() OVERRIDE {} | 169 virtual void UpdateWindowIcon() OVERRIDE {} |
| 169 | 170 |
| 170 // Overridden from views::View: | 171 // Overridden from views::View: |
| 171 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 172 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 172 virtual void Layout() OVERRIDE; | 173 virtual void Layout() OVERRIDE; |
| 173 virtual void OnThemeChanged() OVERRIDE; | 174 virtual void OnThemeChanged() OVERRIDE; |
| 174 | 175 |
| 175 // Overridden from views::ButtonListener: | 176 // Overridden from views::ButtonListener: |
| 176 virtual void ButtonPressed(views::Button* sender, const views::Event& event) | 177 virtual void ButtonPressed(views::Button* sender, const views::Event& event) |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // Fall back to the caption if no other component matches. | 343 // Fall back to the caption if no other component matches. |
| 343 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; | 344 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; |
| 344 } | 345 } |
| 345 | 346 |
| 346 void ConstrainedWindowFrameView::GetWindowMask(const gfx::Size& size, | 347 void ConstrainedWindowFrameView::GetWindowMask(const gfx::Size& size, |
| 347 gfx::Path* window_mask) { | 348 gfx::Path* window_mask) { |
| 348 DCHECK(window_mask); | 349 DCHECK(window_mask); |
| 349 views::GetDefaultWindowMask(size, window_mask); | 350 views::GetDefaultWindowMask(size, window_mask); |
| 350 } | 351 } |
| 351 | 352 |
| 353 void ConstrainedWindowFrameView::EnableClose(bool enable) { |
| 354 close_button_->SetEnabled(enable); |
| 355 } |
| 356 |
| 352 //////////////////////////////////////////////////////////////////////////////// | 357 //////////////////////////////////////////////////////////////////////////////// |
| 353 // ConstrainedWindowFrameView, views::View implementation: | 358 // ConstrainedWindowFrameView, views::View implementation: |
| 354 | 359 |
| 355 void ConstrainedWindowFrameView::OnPaint(gfx::Canvas* canvas) { | 360 void ConstrainedWindowFrameView::OnPaint(gfx::Canvas* canvas) { |
| 356 PaintFrameBorder(canvas); | 361 PaintFrameBorder(canvas); |
| 357 PaintTitleBar(canvas); | 362 PaintTitleBar(canvas); |
| 358 PaintClientEdge(canvas); | 363 PaintClientEdge(canvas); |
| 359 } | 364 } |
| 360 | 365 |
| 361 void ConstrainedWindowFrameView::Layout() { | 366 void ConstrainedWindowFrameView::Layout() { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 } | 664 } |
| 660 | 665 |
| 661 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 666 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
| 662 Activate(); | 667 Activate(); |
| 663 } | 668 } |
| 664 | 669 |
| 665 views::internal::NativeWidgetDelegate* | 670 views::internal::NativeWidgetDelegate* |
| 666 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 671 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
| 667 return this; | 672 return this; |
| 668 } | 673 } |
| OLD | NEW |