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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 virtual void ResetWindowControls() OVERRIDE {} | 180 virtual void ResetWindowControls() OVERRIDE {} |
181 virtual void UpdateWindowIcon() OVERRIDE {} | 181 virtual void UpdateWindowIcon() OVERRIDE {} |
182 | 182 |
183 // Overridden from views::View: | 183 // Overridden from views::View: |
184 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 184 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
185 virtual void Layout() OVERRIDE; | 185 virtual void Layout() OVERRIDE; |
186 virtual void OnThemeChanged() OVERRIDE; | 186 virtual void OnThemeChanged() OVERRIDE; |
187 | 187 |
188 // Overridden from views::ButtonListener: | 188 // Overridden from views::ButtonListener: |
189 virtual void ButtonPressed(views::Button* sender, | 189 virtual void ButtonPressed(views::Button* sender, |
190 const views::Event& event) OVERRIDE; | 190 const ui::Event& event) OVERRIDE; |
191 | 191 |
192 private: | 192 private: |
193 // Returns the thickness of the entire nonclient left, right, and bottom | 193 // Returns the thickness of the entire nonclient left, right, and bottom |
194 // borders, including both the window frame and any client edge. | 194 // borders, including both the window frame and any client edge. |
195 int NonClientBorderThickness() const; | 195 int NonClientBorderThickness() const; |
196 | 196 |
197 // Returns the height of the entire nonclient top border, including the window | 197 // Returns the height of the entire nonclient top border, including the window |
198 // frame, any title area, and any connected client edge. | 198 // frame, any title area, and any connected client edge. |
199 int NonClientTopBorderHeight() const; | 199 int NonClientTopBorderHeight() const; |
200 | 200 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } | 383 } |
384 | 384 |
385 void ConstrainedWindowFrameView::OnThemeChanged() { | 385 void ConstrainedWindowFrameView::OnThemeChanged() { |
386 InitWindowResources(); | 386 InitWindowResources(); |
387 } | 387 } |
388 | 388 |
389 //////////////////////////////////////////////////////////////////////////////// | 389 //////////////////////////////////////////////////////////////////////////////// |
390 // ConstrainedWindowFrameView, views::ButtonListener implementation: | 390 // ConstrainedWindowFrameView, views::ButtonListener implementation: |
391 | 391 |
392 void ConstrainedWindowFrameView::ButtonPressed( | 392 void ConstrainedWindowFrameView::ButtonPressed( |
393 views::Button* sender, const views::Event& event) { | 393 views::Button* sender, const ui::Event& event) { |
394 if (sender == close_button_) | 394 if (sender == close_button_) |
395 container_->CloseConstrainedWindow(); | 395 container_->CloseConstrainedWindow(); |
396 } | 396 } |
397 | 397 |
398 //////////////////////////////////////////////////////////////////////////////// | 398 //////////////////////////////////////////////////////////////////////////////// |
399 // ConstrainedWindowFrameView, private: | 399 // ConstrainedWindowFrameView, private: |
400 | 400 |
401 int ConstrainedWindowFrameView::NonClientBorderThickness() const { | 401 int ConstrainedWindowFrameView::NonClientBorderThickness() const { |
402 return kFrameBorderThickness + kClientEdgeThickness; | 402 return kFrameBorderThickness + kClientEdgeThickness; |
403 } | 403 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 | 552 |
553 void Init(ConstrainedWindowViews* container) { | 553 void Init(ConstrainedWindowViews* container) { |
554 container_ = container; | 554 container_ = container; |
555 ash::CustomFrameViewAsh::Init(container); | 555 ash::CustomFrameViewAsh::Init(container); |
556 // Always use "active" look. | 556 // Always use "active" look. |
557 SetInactiveRenderingDisabled(true); | 557 SetInactiveRenderingDisabled(true); |
558 } | 558 } |
559 | 559 |
560 // views::ButtonListener overrides: | 560 // views::ButtonListener overrides: |
561 virtual void ButtonPressed(views::Button* sender, | 561 virtual void ButtonPressed(views::Button* sender, |
562 const views::Event& event) OVERRIDE { | 562 const ui::Event& event) OVERRIDE { |
563 if (sender == close_button()) | 563 if (sender == close_button()) |
564 container_->CloseConstrainedWindow(); | 564 container_->CloseConstrainedWindow(); |
565 } | 565 } |
566 | 566 |
567 private: | 567 private: |
568 ConstrainedWindowViews* container_; // not owned | 568 ConstrainedWindowViews* container_; // not owned |
569 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameViewAsh); | 569 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameViewAsh); |
570 }; | 570 }; |
571 #endif // defined(USE_ASH) | 571 #endif // defined(USE_ASH) |
572 | 572 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 679 |
680 views::internal::NativeWidgetDelegate* | 680 views::internal::NativeWidgetDelegate* |
681 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 681 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
682 return this; | 682 return this; |
683 } | 683 } |
684 | 684 |
685 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { | 685 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { |
686 // Prevent a constrained window to be moved by the user. | 686 // Prevent a constrained window to be moved by the user. |
687 return HTNOWHERE; | 687 return HTNOWHERE; |
688 } | 688 } |
OLD | NEW |