| 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/opaque_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "ui/gfx/image/image_skia.h" | 38 #include "ui/gfx/image/image_skia.h" |
| 39 #include "ui/gfx/path.h" | 39 #include "ui/gfx/path.h" |
| 40 #include "ui/views/controls/button/image_button.h" | 40 #include "ui/views/controls/button/image_button.h" |
| 41 #include "ui/views/controls/image_view.h" | 41 #include "ui/views/controls/image_view.h" |
| 42 #include "ui/views/controls/label.h" | 42 #include "ui/views/controls/label.h" |
| 43 #include "ui/views/widget/root_view.h" | 43 #include "ui/views/widget/root_view.h" |
| 44 #include "ui/views/window/frame_background.h" | 44 #include "ui/views/window/frame_background.h" |
| 45 #include "ui/views/window/window_shape.h" | 45 #include "ui/views/window/window_shape.h" |
| 46 | 46 |
| 47 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
| 48 #include "base/win/metro.h" | 48 #include "win8/util/win8_util.h" |
| 49 #endif // OS_WIN | 49 #endif // OS_WIN |
| 50 | 50 |
| 51 using content::WebContents; | 51 using content::WebContents; |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| 54 | 54 |
| 55 // The frame border is only visible in restored mode and is hardcoded to 4 px on | 55 // The frame border is only visible in restored mode and is hardcoded to 4 px on |
| 56 // each side regardless of the system window border size. | 56 // each side regardless of the system window border size. |
| 57 const int kFrameBorderThickness = 4; | 57 const int kFrameBorderThickness = 4; |
| 58 // Besides the frame border, there's another 9 px of empty space atop the | 58 // Besides the frame border, there's another 9 px of empty space atop the |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 const views::View* dst, const gfx::Point& pt) { | 111 const views::View* dst, const gfx::Point& pt) { |
| 112 DCHECK(src); | 112 DCHECK(src); |
| 113 DCHECK(dst); | 113 DCHECK(dst); |
| 114 gfx::Point origin(bounds.origin()); | 114 gfx::Point origin(bounds.origin()); |
| 115 views::View::ConvertPointToTarget(src, dst, &origin); | 115 views::View::ConvertPointToTarget(src, dst, &origin); |
| 116 bounds.set_origin(origin); | 116 bounds.set_origin(origin); |
| 117 return bounds.Contains(pt); | 117 return bounds.Contains(pt); |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool ShouldAddDefaultCaptionButtons() { | 120 bool ShouldAddDefaultCaptionButtons() { |
| 121 #if defined(OS_WIN) && !defined(USE_AURA) | 121 #if defined(OS_WIN) |
| 122 return !base::win::IsMetroProcess(); | 122 return !win8::IsSingleWindowMetroMode(); |
| 123 #endif // OS_WIN | 123 #endif // OS_WIN |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace | 127 } // namespace |
| 128 | 128 |
| 129 /////////////////////////////////////////////////////////////////////////////// | 129 /////////////////////////////////////////////////////////////////////////////// |
| 130 // OpaqueBrowserFrameView, public: | 130 // OpaqueBrowserFrameView, public: |
| 131 | 131 |
| 132 OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, | 132 OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 | 1025 |
| 1026 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, | 1026 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, |
| 1027 int height) const { | 1027 int height) const { |
| 1028 int top_height = NonClientTopBorderHeight(false); | 1028 int top_height = NonClientTopBorderHeight(false); |
| 1029 int border_thickness = NonClientBorderThickness(); | 1029 int border_thickness = NonClientBorderThickness(); |
| 1030 return gfx::Rect(border_thickness, top_height, | 1030 return gfx::Rect(border_thickness, top_height, |
| 1031 std::max(0, width - (2 * border_thickness)), | 1031 std::max(0, width - (2 * border_thickness)), |
| 1032 std::max(0, height - GetReservedHeight() - | 1032 std::max(0, height - GetReservedHeight() - |
| 1033 top_height - border_thickness)); | 1033 top_height - border_thickness)); |
| 1034 } | 1034 } |
| OLD | NEW |