| 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; | |
| 168 virtual void ResetWindowControls() OVERRIDE {} | 167 virtual void ResetWindowControls() OVERRIDE {} |
| 169 virtual void UpdateWindowIcon() OVERRIDE {} | 168 virtual void UpdateWindowIcon() OVERRIDE {} |
| 170 | 169 |
| 171 // Overridden from views::View: | 170 // Overridden from views::View: |
| 172 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 171 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 173 virtual void Layout() OVERRIDE; | 172 virtual void Layout() OVERRIDE; |
| 174 virtual void OnThemeChanged() OVERRIDE; | 173 virtual void OnThemeChanged() OVERRIDE; |
| 175 | 174 |
| 176 // Overridden from views::ButtonListener: | 175 // Overridden from views::ButtonListener: |
| 177 virtual void ButtonPressed(views::Button* sender, const views::Event& event) | 176 virtual void ButtonPressed(views::Button* sender, const views::Event& event) |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // Fall back to the caption if no other component matches. | 342 // Fall back to the caption if no other component matches. |
| 344 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; | 343 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; |
| 345 } | 344 } |
| 346 | 345 |
| 347 void ConstrainedWindowFrameView::GetWindowMask(const gfx::Size& size, | 346 void ConstrainedWindowFrameView::GetWindowMask(const gfx::Size& size, |
| 348 gfx::Path* window_mask) { | 347 gfx::Path* window_mask) { |
| 349 DCHECK(window_mask); | 348 DCHECK(window_mask); |
| 350 views::GetDefaultWindowMask(size, window_mask); | 349 views::GetDefaultWindowMask(size, window_mask); |
| 351 } | 350 } |
| 352 | 351 |
| 353 void ConstrainedWindowFrameView::EnableClose(bool enable) { | |
| 354 close_button_->SetEnabled(enable); | |
| 355 } | |
| 356 | |
| 357 //////////////////////////////////////////////////////////////////////////////// | 352 //////////////////////////////////////////////////////////////////////////////// |
| 358 // ConstrainedWindowFrameView, views::View implementation: | 353 // ConstrainedWindowFrameView, views::View implementation: |
| 359 | 354 |
| 360 void ConstrainedWindowFrameView::OnPaint(gfx::Canvas* canvas) { | 355 void ConstrainedWindowFrameView::OnPaint(gfx::Canvas* canvas) { |
| 361 PaintFrameBorder(canvas); | 356 PaintFrameBorder(canvas); |
| 362 PaintTitleBar(canvas); | 357 PaintTitleBar(canvas); |
| 363 PaintClientEdge(canvas); | 358 PaintClientEdge(canvas); |
| 364 } | 359 } |
| 365 | 360 |
| 366 void ConstrainedWindowFrameView::Layout() { | 361 void ConstrainedWindowFrameView::Layout() { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 } | 659 } |
| 665 | 660 |
| 666 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 661 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
| 667 Activate(); | 662 Activate(); |
| 668 } | 663 } |
| 669 | 664 |
| 670 views::internal::NativeWidgetDelegate* | 665 views::internal::NativeWidgetDelegate* |
| 671 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 666 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
| 672 return this; | 667 return this; |
| 673 } | 668 } |
| OLD | NEW |