Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1015)

Side by Side Diff: chrome/browser/views/frame/glass_browser_frame_view.cc

Issue 28338: Make Chromium windows not hide auto-hide taskbars.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/frame/glass_browser_frame_view.h" 5 #include "chrome/browser/views/frame/glass_browser_frame_view.h"
6 6
7 #include "chrome/browser/views/frame/browser_view.h" 7 #include "chrome/browser/views/frame/browser_view.h"
8 #include "chrome/browser/views/tabs/tab_strip.h" 8 #include "chrome/browser/views/tabs/tab_strip.h"
9 #include "chrome/common/gfx/chrome_canvas.h" 9 #include "chrome/common/gfx/chrome_canvas.h"
10 #include "chrome/common/resource_bundle.h" 10 #include "chrome/common/resource_bundle.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 int border_thickness = NonClientBorderThickness(); 171 int border_thickness = NonClientBorderThickness();
172 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), 172 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness),
173 std::max(0, client_bounds.y() - top_height), 173 std::max(0, client_bounds.y() - top_height),
174 client_bounds.width() + (2 * border_thickness), 174 client_bounds.width() + (2 * border_thickness),
175 client_bounds.height() + top_height + border_thickness); 175 client_bounds.height() + top_height + border_thickness);
176 } 176 }
177 177
178 gfx::Point GlassBrowserFrameView::GetSystemMenuPoint() const { 178 gfx::Point GlassBrowserFrameView::GetSystemMenuPoint() const {
179 gfx::Point system_menu_point; 179 gfx::Point system_menu_point;
180 if (browser_view_->IsBrowserTypeNormal()) { 180 if (browser_view_->IsBrowserTypeNormal()) {
181 // The maximized mode bit here is because in maximized mode the frame edge 181 // The maximized mode bit here is because in maximized mode there is no
182 // and the client edge are both offscreen, whereas in the opaque frame 182 // client edge, but in restored mode there is one, and unlike in the opaque
183 // (where we don't do this trick) maximized windows have no client edge and 183 // frame we don't have a convenient function to get its coordinate (since
184 // only the frame edge is offscreen. 184 // FrameBorderThickness() won't do what we want).
185 system_menu_point.SetPoint(NonClientBorderThickness() - 185 system_menu_point.SetPoint(NonClientBorderThickness() -
186 (frame_->IsMaximized() ? 0 : kClientEdgeThickness), 186 (frame_->IsMaximized() ? 0 : kClientEdgeThickness),
187 NonClientTopBorderHeight() + browser_view_->GetTabStripHeight() - 187 NonClientTopBorderHeight() + browser_view_->GetTabStripHeight() -
188 kClientEdgeThickness); 188 kClientEdgeThickness);
189 } else { 189 } else {
190 system_menu_point.SetPoint(0, -kFrameShadowThickness); 190 system_menu_point.SetPoint(0, -kFrameShadowThickness);
191 } 191 }
192 ConvertPointToScreen(this, &system_menu_point); 192 ConvertPointToScreen(this, &system_menu_point);
193 return system_menu_point; 193 return system_menu_point;
194 } 194 }
(...skipping 22 matching lines...) Expand all
217 /////////////////////////////////////////////////////////////////////////////// 217 ///////////////////////////////////////////////////////////////////////////////
218 // GlassBrowserFrameView, views::View overrides: 218 // GlassBrowserFrameView, views::View overrides:
219 219
220 void GlassBrowserFrameView::Paint(ChromeCanvas* canvas) { 220 void GlassBrowserFrameView::Paint(ChromeCanvas* canvas) {
221 if (!browser_view_->IsTabStripVisible()) 221 if (!browser_view_->IsTabStripVisible())
222 return; // Nothing is visible, so don't bother to paint. 222 return; // Nothing is visible, so don't bother to paint.
223 223
224 PaintDistributorLogo(canvas); 224 PaintDistributorLogo(canvas);
225 PaintToolbarBackground(canvas); 225 PaintToolbarBackground(canvas);
226 PaintOTRAvatar(canvas); 226 PaintOTRAvatar(canvas);
227 PaintClientEdge(canvas); 227 if (!frame_->IsMaximized())
228 PaintRestoredClientEdge(canvas);
228 } 229 }
229 230
230 void GlassBrowserFrameView::Layout() { 231 void GlassBrowserFrameView::Layout() {
231 LayoutDistributorLogo(); 232 LayoutDistributorLogo();
232 LayoutOTRAvatar(); 233 LayoutOTRAvatar();
233 LayoutClientView(); 234 LayoutClientView();
234 } 235 }
235 236
236 /////////////////////////////////////////////////////////////////////////////// 237 ///////////////////////////////////////////////////////////////////////////////
237 // GlassBrowserFrameView, private: 238 // GlassBrowserFrameView, private:
238 239
239 int GlassBrowserFrameView::FrameBorderThickness() const { 240 int GlassBrowserFrameView::FrameBorderThickness() const {
240 return GetSystemMetrics(SM_CXSIZEFRAME); 241 return browser_view_->CanCurrentlyResize() ?
242 GetSystemMetrics(SM_CXSIZEFRAME) : 0;
241 } 243 }
242 244
243 int GlassBrowserFrameView::NonClientBorderThickness() const { 245 int GlassBrowserFrameView::NonClientBorderThickness() const {
244 return kNonClientBorderThickness; 246 return browser_view_->CanCurrentlyResize() ? kNonClientBorderThickness : 0;
245 } 247 }
246 248
247 int GlassBrowserFrameView::NonClientTopBorderHeight() const { 249 int GlassBrowserFrameView::NonClientTopBorderHeight() const {
248 return FrameBorderThickness() + 250 if (browser_view_->IsFullscreen())
249 (frame_->IsMaximized() ? 0 : kNonClientRestoredExtraThickness); 251 return 0;
252 // We'd like to use FrameBorderThickness() here, but the maximized Aero glass
253 // frame has a 0 frame border around most edges and a CXSIZEFRAME-thick border
254 // at the top (see AeroGlassFrame::OnGetMinMaxInfo()).
255 return GetSystemMetrics(SM_CXSIZEFRAME) +
256 (browser_view_->IsMaximized() ? 0 : kNonClientRestoredExtraThickness);
250 } 257 }
251 258
252 void GlassBrowserFrameView::PaintDistributorLogo(ChromeCanvas* canvas) { 259 void GlassBrowserFrameView::PaintDistributorLogo(ChromeCanvas* canvas) {
253 // The distributor logo is only painted when the frame is not maximized and 260 // The distributor logo is only painted when the frame is not maximized and
254 // when we actually have a logo. 261 // when we actually have a logo.
255 if (!frame_->IsMaximized() && distributor_logo_) { 262 if (!frame_->IsMaximized() && distributor_logo_) {
256 // NOTE: We don't mirror the logo placement here because the outer frame 263 // NOTE: We don't mirror the logo placement here because the outer frame
257 // itself isn't mirrored in RTL. This is a bug; if it is fixed, this should 264 // itself isn't mirrored in RTL. This is a bug; if it is fixed, this should
258 // be mirrored as in opaque_non_client_view.cc. 265 // be mirrored as in opaque_non_client_view.cc.
259 canvas->DrawBitmapInt(*distributor_logo_, logo_bounds_.x(), 266 canvas->DrawBitmapInt(*distributor_logo_, logo_bounds_.x(),
(...skipping 27 matching lines...) Expand all
287 return; 294 return;
288 295
289 SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon(); 296 SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon();
290 canvas->DrawBitmapInt(otr_avatar_icon, 0, 297 canvas->DrawBitmapInt(otr_avatar_icon, 0,
291 (otr_avatar_icon.height() - otr_avatar_bounds_.height()) / 2, 298 (otr_avatar_icon.height() - otr_avatar_bounds_.height()) / 2,
292 otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), 299 otr_avatar_bounds_.width(), otr_avatar_bounds_.height(),
293 MirroredLeftPointForRect(otr_avatar_bounds_), otr_avatar_bounds_.y(), 300 MirroredLeftPointForRect(otr_avatar_bounds_), otr_avatar_bounds_.y(),
294 otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), false); 301 otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), false);
295 } 302 }
296 303
297 void GlassBrowserFrameView::PaintClientEdge(ChromeCanvas* canvas) { 304 void GlassBrowserFrameView::PaintRestoredClientEdge(ChromeCanvas* canvas) {
298 // The client edges start below the toolbar upper corner images regardless 305 // The client edges start below the toolbar upper corner images regardless
299 // of how tall the toolbar itself is. 306 // of how tall the toolbar itself is.
300 int client_area_top = 307 int client_area_top =
301 frame_->client_view()->y() + browser_view_->GetToolbarBounds().y() + 308 frame_->client_view()->y() + browser_view_->GetToolbarBounds().y() +
302 resources_->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT)->height(); 309 resources_->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT)->height();
303 310
304 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); 311 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height());
305 int client_area_bottom = 312 int client_area_bottom =
306 std::max(client_area_top, height() - NonClientBorderThickness()); 313 std::max(client_area_top, height() - NonClientBorderThickness());
307 int client_area_height = client_area_bottom - client_area_top; 314 int client_area_height = client_area_bottom - client_area_top;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 421
415 #if defined(GOOGLE_CHROME_BUILD) 422 #if defined(GOOGLE_CHROME_BUILD)
416 distributor_logo_ = ResourceBundle::GetSharedInstance(). 423 distributor_logo_ = ResourceBundle::GetSharedInstance().
417 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); 424 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO);
418 #endif 425 #endif
419 426
420 initialized = true; 427 initialized = true;
421 } 428 }
422 } 429 }
423 430
OLDNEW
« no previous file with comments | « chrome/browser/views/frame/glass_browser_frame_view.h ('k') | chrome/browser/views/frame/opaque_browser_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698