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 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 5 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
9 #include "chrome/browser/profiles/profile_info_util.h" | 9 #include "chrome/browser/profiles/profile_info_util.h" |
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // Devtools windows don't get themed. | 405 // Devtools windows don't get themed. |
406 if (windowStyle & THEMED_DEVTOOLS) | 406 if (windowStyle & THEMED_DEVTOOLS) |
407 return NO; | 407 return NO; |
408 | 408 |
409 BOOL active = [[view window] isMainWindow]; | 409 BOOL active = [[view window] isMainWindow]; |
410 BOOL incognito = windowStyle & THEMED_INCOGNITO; | 410 BOOL incognito = windowStyle & THEMED_INCOGNITO; |
411 BOOL popup = windowStyle & THEMED_POPUP; | 411 BOOL popup = windowStyle & THEMED_POPUP; |
412 | 412 |
413 // Find a theme image. | 413 // Find a theme image. |
414 NSColor* themeImageColor = nil; | 414 NSColor* themeImageColor = nil; |
415 int themeImageID; | 415 if (!popup) { |
416 if (popup && active) | 416 int themeImageID; |
417 themeImageID = IDR_THEME_TOOLBAR; | 417 if (active && incognito) |
418 else if (popup && !active) | 418 themeImageID = IDR_THEME_FRAME_INCOGNITO; |
419 themeImageID = IDR_THEME_TAB_BACKGROUND; | 419 else if (active && !incognito) |
420 else if (!popup && active && incognito) | 420 themeImageID = IDR_THEME_FRAME; |
421 themeImageID = IDR_THEME_FRAME_INCOGNITO; | 421 else if (!active && incognito) |
422 else if (!popup && active && !incognito) | 422 themeImageID = IDR_THEME_FRAME_INCOGNITO_INACTIVE; |
423 themeImageID = IDR_THEME_FRAME; | 423 else |
424 else if (!popup && !active && incognito) | 424 themeImageID = IDR_THEME_FRAME_INACTIVE; |
425 themeImageID = IDR_THEME_FRAME_INCOGNITO_INACTIVE; | 425 if (themeProvider->HasCustomImage(IDR_THEME_FRAME)) |
426 else | 426 themeImageColor = themeProvider->GetNSImageColorNamed(themeImageID, true); |
427 themeImageID = IDR_THEME_FRAME_INACTIVE; | 427 } |
428 if (themeProvider->HasCustomImage(IDR_THEME_FRAME)) | |
429 themeImageColor = themeProvider->GetNSImageColorNamed(themeImageID, true); | |
430 | 428 |
431 // If no theme image, use a gradient if incognito. | 429 // If no theme image, use a gradient if incognito. |
432 NSGradient* gradient = nil; | 430 NSGradient* gradient = nil; |
433 if (!themeImageColor && incognito) | 431 if (!themeImageColor && incognito) |
434 gradient = themeProvider->GetNSGradient( | 432 gradient = themeProvider->GetNSGradient( |
435 active ? ThemeProperties::GRADIENT_FRAME_INCOGNITO : | 433 active ? ThemeProperties::GRADIENT_FRAME_INCOGNITO : |
436 ThemeProperties::GRADIENT_FRAME_INCOGNITO_INACTIVE); | 434 ThemeProperties::GRADIENT_FRAME_INCOGNITO_INACTIVE); |
437 | 435 |
438 BOOL themed = NO; | 436 BOOL themed = NO; |
439 if (themeImageColor) { | 437 if (themeImageColor) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 505 |
508 return themed; | 506 return themed; |
509 } | 507 } |
510 | 508 |
511 - (NSColor*)titleColor { | 509 - (NSColor*)titleColor { |
512 ui::ThemeProvider* themeProvider = [self themeProvider]; | 510 ui::ThemeProvider* themeProvider = [self themeProvider]; |
513 if (!themeProvider) | 511 if (!themeProvider) |
514 return [NSColor windowFrameTextColor]; | 512 return [NSColor windowFrameTextColor]; |
515 | 513 |
516 ThemedWindowStyle windowStyle = [self themedWindowStyle]; | 514 ThemedWindowStyle windowStyle = [self themedWindowStyle]; |
517 BOOL active = [self isMainWindow]; | |
518 BOOL incognito = windowStyle & THEMED_INCOGNITO; | 515 BOOL incognito = windowStyle & THEMED_INCOGNITO; |
519 BOOL popup = windowStyle & THEMED_POPUP; | |
520 | |
521 NSColor* titleColor = nil; | |
522 if (popup && active) { | |
523 titleColor = themeProvider->GetNSColor( | |
524 ThemeProperties::COLOR_TAB_TEXT, false); | |
525 } else if (popup && !active) { | |
526 titleColor = themeProvider->GetNSColor( | |
527 ThemeProperties::COLOR_BACKGROUND_TAB_TEXT, false); | |
528 } | |
529 | |
530 if (titleColor) | |
531 return titleColor; | |
532 | 516 |
533 if (incognito) | 517 if (incognito) |
534 return [NSColor whiteColor]; | 518 return [NSColor whiteColor]; |
535 else | 519 else |
536 return [NSColor windowFrameTextColor]; | 520 return [NSColor windowFrameTextColor]; |
537 } | 521 } |
538 | 522 |
539 @end | 523 @end |
OLD | NEW |