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

Side by Side Diff: ui/views/window/custom_frame_view.cc

Issue 8574033: Beginnings of Window Modality support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « ui/gfx/compositor/compositor.gyp ('k') | views/widget/native_widget_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/window/custom_frame_view.h" 5 #include "ui/views/window/custom_frame_view.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 "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 SkBitmap* frame_image; 321 SkBitmap* frame_image;
322 SkColor frame_color; 322 SkColor frame_color;
323 if (frame_->IsActive()) { 323 if (frame_->IsActive()) {
324 frame_image = rb.GetBitmapNamed(IDR_FRAME); 324 frame_image = rb.GetBitmapNamed(IDR_FRAME);
325 frame_color = ResourceBundle::frame_color; 325 frame_color = ResourceBundle::frame_color;
326 } else { 326 } else {
327 frame_image = rb.GetBitmapNamed(IDR_FRAME_INACTIVE); 327 frame_image = rb.GetBitmapNamed(IDR_FRAME_INACTIVE);
328 frame_color = ResourceBundle::frame_color_inactive; 328 frame_color = ResourceBundle::frame_color_inactive;
329 } 329 }
330 330
331 #if defined(USE_AURA)
332 // TODO(jamescook): Remove this when Aura defaults to its own window frame,
333 // BrowserNonClientFrameViewAura. Until then, use custom square corners to
334 // avoid performance penalties associated with transparent layers.
335 SkBitmap* top_left_corner = rb.GetBitmapNamed(IDR_AURA_WINDOW_TOP_LEFT);
336 SkBitmap* top_right_corner = rb.GetBitmapNamed(IDR_AURA_WINDOW_TOP_RIGHT);
337 SkBitmap* bottom_left_corner =
338 rb.GetBitmapNamed(IDR_AURA_WINDOW_BOTTOM_LEFT);
339 SkBitmap* bottom_right_corner =
340 rb.GetBitmapNamed(IDR_AURA_WINDOW_BOTTOM_RIGHT);
341 #else
331 SkBitmap* top_left_corner = rb.GetBitmapNamed(IDR_WINDOW_TOP_LEFT_CORNER); 342 SkBitmap* top_left_corner = rb.GetBitmapNamed(IDR_WINDOW_TOP_LEFT_CORNER);
332 SkBitmap* top_right_corner = 343 SkBitmap* top_right_corner =
333 rb.GetBitmapNamed(IDR_WINDOW_TOP_RIGHT_CORNER); 344 rb.GetBitmapNamed(IDR_WINDOW_TOP_RIGHT_CORNER);
334 SkBitmap* top_edge = rb.GetBitmapNamed(IDR_WINDOW_TOP_CENTER);
335 SkBitmap* right_edge = rb.GetBitmapNamed(IDR_WINDOW_RIGHT_SIDE);
336 SkBitmap* left_edge = rb.GetBitmapNamed(IDR_WINDOW_LEFT_SIDE);
337 SkBitmap* bottom_left_corner = 345 SkBitmap* bottom_left_corner =
338 rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER); 346 rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER);
339 SkBitmap* bottom_right_corner = 347 SkBitmap* bottom_right_corner =
340 rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER); 348 rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER);
349 #endif
350 SkBitmap* top_edge = rb.GetBitmapNamed(IDR_WINDOW_TOP_CENTER);
351 SkBitmap* right_edge = rb.GetBitmapNamed(IDR_WINDOW_RIGHT_SIDE);
352 SkBitmap* left_edge = rb.GetBitmapNamed(IDR_WINDOW_LEFT_SIDE);
341 SkBitmap* bottom_edge = rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_CENTER); 353 SkBitmap* bottom_edge = rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_CENTER);
342 354
343 // Fill with the frame color first so we have a constant background for 355 // Fill with the frame color first so we have a constant background for
344 // areas not covered by the theme image. 356 // areas not covered by the theme image.
345 canvas->FillRect(frame_color, 357 canvas->FillRect(frame_color,
346 gfx::Rect(0, 0, width(), frame_image->height())); 358 gfx::Rect(0, 0, width(), frame_image->height()));
347 359
348 int remaining_height = height() - frame_image->height(); 360 int remaining_height = height() - frame_image->height();
349 if (remaining_height > 0) { 361 if (remaining_height > 0) {
350 // Now fill down the sides. 362 // Now fill down the sides.
351 canvas->FillRect(frame_color, 363 canvas->FillRect(frame_color,
352 gfx::Rect(0, frame_image->height(), left_edge->width(), 364 gfx::Rect(0, frame_image->height(), left_edge->width(),
353 remaining_height)); 365 remaining_height));
354 canvas->FillRect(frame_color, 366 canvas->FillRect(frame_color,
355 gfx::Rect(width() - right_edge->width(), 367 gfx::Rect(width() - right_edge->width(),
356 frame_image->height(), right_edge->width(), 368 frame_image->height(), right_edge->width(),
357 remaining_height)); 369 remaining_height));
358 int center_width = width() - left_edge->width() - right_edge->width(); 370 int center_width = width() - left_edge->width() - right_edge->width();
359 if (center_width > 0) { 371 if (center_width > 0) {
360 // Now fill the bottom area. 372 // Now fill the bottom area.
361 canvas->FillRect(frame_color, 373 canvas->FillRect(frame_color,
362 gfx::Rect(left_edge->width(), 374 gfx::Rect(left_edge->width(),
363 height() - bottom_edge->height(), 375 height() - bottom_edge->height(),
364 center_width, bottom_edge->height())); 376 center_width, bottom_edge->height()));
365 } 377 }
366 } 378 }
367 379
380 // Don't draw the colored frame on Aura, just the frame color.
381 #if !defined(USE_AURA)
368 // Draw the theme frame. 382 // Draw the theme frame.
369 canvas->TileImageInt(*frame_image, 0, 0, width(), frame_image->height()); 383 canvas->TileImageInt(*frame_image, 0, 0, width(), frame_image->height());
384 #endif
370 385
371 // Top. 386 // Top.
372 canvas->DrawBitmapInt(*top_left_corner, 0, 0); 387 canvas->DrawBitmapInt(*top_left_corner, 0, 0);
373 canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, 388 canvas->TileImageInt(*top_edge, top_left_corner->width(), 0,
374 width() - top_right_corner->width(), top_edge->height()); 389 width() - top_right_corner->width(), top_edge->height());
375 canvas->DrawBitmapInt(*top_right_corner, 390 canvas->DrawBitmapInt(*top_right_corner,
376 width() - top_right_corner->width(), 0); 391 width() - top_right_corner->width(), 0);
377 392
378 // Right. 393 // Right.
379 canvas->TileImageInt(*right_edge, width() - right_edge->width(), 394 canvas->TileImageInt(*right_edge, width() - right_edge->width(),
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont()); 600 title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont());
586 #elif defined(OS_LINUX) 601 #elif defined(OS_LINUX)
587 // TODO(ben): need to resolve what font this is. 602 // TODO(ben): need to resolve what font this is.
588 title_font_ = new gfx::Font(); 603 title_font_ = new gfx::Font();
589 #endif 604 #endif
590 initialized = true; 605 initialized = true;
591 } 606 }
592 } 607 }
593 608
594 } // namespace views 609 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/compositor/compositor.gyp ('k') | views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698