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 24 matching lines...) Expand all Loading... |
35 #include "ui/gfx/canvas.h" | 35 #include "ui/gfx/canvas.h" |
36 #include "ui/gfx/font.h" | 36 #include "ui/gfx/font.h" |
37 #include "ui/gfx/image/image.h" | 37 #include "ui/gfx/image/image.h" |
38 #include "ui/gfx/path.h" | 38 #include "ui/gfx/path.h" |
39 #include "ui/views/controls/button/image_button.h" | 39 #include "ui/views/controls/button/image_button.h" |
40 #include "ui/views/controls/image_view.h" | 40 #include "ui/views/controls/image_view.h" |
41 #include "ui/views/widget/root_view.h" | 41 #include "ui/views/widget/root_view.h" |
42 #include "ui/views/window/frame_background.h" | 42 #include "ui/views/window/frame_background.h" |
43 #include "ui/views/window/window_shape.h" | 43 #include "ui/views/window/window_shape.h" |
44 | 44 |
45 #if defined(USE_VIRTUAL_KEYBOARD) | |
46 #include "chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.h" | |
47 #endif | |
48 | |
49 using content::WebContents; | 45 using content::WebContents; |
50 | 46 |
51 namespace { | 47 namespace { |
52 | 48 |
53 // The frame border is only visible in restored mode and is hardcoded to 4 px on | 49 // The frame border is only visible in restored mode and is hardcoded to 4 px on |
54 // each side regardless of the system window border size. | 50 // each side regardless of the system window border size. |
55 const int kFrameBorderThickness = 4; | 51 const int kFrameBorderThickness = 4; |
56 // Besides the frame border, there's another 9 px of empty space atop the | 52 // Besides the frame border, there's another 9 px of empty space atop the |
57 // window in restored mode, to use to drag the window around. | 53 // window in restored mode, to use to drag the window around. |
58 const int kNonClientRestoredExtraThickness = 9; | 54 const int kNonClientRestoredExtraThickness = 9; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 window_icon_->set_is_light(true); | 148 window_icon_->set_is_light(true); |
153 AddChildView(window_icon_); | 149 AddChildView(window_icon_); |
154 window_icon_->Update(); | 150 window_icon_->Update(); |
155 } | 151 } |
156 | 152 |
157 UpdateAvatarInfo(); | 153 UpdateAvatarInfo(); |
158 if (!browser_view->IsOffTheRecord()) { | 154 if (!browser_view->IsOffTheRecord()) { |
159 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, | 155 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
160 content::NotificationService::AllSources()); | 156 content::NotificationService::AllSources()); |
161 } | 157 } |
162 | |
163 #if defined(USE_VIRTUAL_KEYBOARD) | |
164 // Make sure the singleton VirtualKeyboardManager object is initialized. | |
165 VirtualKeyboardManager::GetInstance(); | |
166 #endif | |
167 } | 158 } |
168 | 159 |
169 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { | 160 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { |
170 } | 161 } |
171 | 162 |
172 /////////////////////////////////////////////////////////////////////////////// | 163 /////////////////////////////////////////////////////////////////////////////// |
173 // OpaqueBrowserFrameView, protected: | 164 // OpaqueBrowserFrameView, protected: |
174 | 165 |
175 int OpaqueBrowserFrameView::GetReservedHeight() const { | 166 int OpaqueBrowserFrameView::GetReservedHeight() const { |
176 return 0; | 167 return 0; |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 | 959 |
969 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, | 960 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, |
970 int height) const { | 961 int height) const { |
971 int top_height = NonClientTopBorderHeight(false); | 962 int top_height = NonClientTopBorderHeight(false); |
972 int border_thickness = NonClientBorderThickness(); | 963 int border_thickness = NonClientBorderThickness(); |
973 return gfx::Rect(border_thickness, top_height, | 964 return gfx::Rect(border_thickness, top_height, |
974 std::max(0, width - (2 * border_thickness)), | 965 std::max(0, width - (2 * border_thickness)), |
975 std::max(0, height - GetReservedHeight() - | 966 std::max(0, height - GetReservedHeight() - |
976 top_height - border_thickness)); | 967 top_height - border_thickness)); |
977 } | 968 } |
OLD | NEW |