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/panels/panel_window_controller_cocoa.h" | 5 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // If the throbber is spinning now, no need to replace it. | 571 // If the throbber is spinning now, no need to replace it. |
572 if ([[titlebar_view_ icon] isKindOfClass:[ThrobberView class]]) | 572 if ([[titlebar_view_ icon] isKindOfClass:[ThrobberView class]]) |
573 return; | 573 return; |
574 | 574 |
575 NSImage* iconImage = | 575 NSImage* iconImage = |
576 ResourceBundle::GetSharedInstance().GetNativeImageNamed(IDR_THROBBER); | 576 ResourceBundle::GetSharedInstance().GetNativeImageNamed(IDR_THROBBER); |
577 icon = [ThrobberView filmstripThrobberViewWithFrame:iconFrame | 577 icon = [ThrobberView filmstripThrobberViewWithFrame:iconFrame |
578 image:iconImage]; | 578 image:iconImage]; |
579 } else { | 579 } else { |
580 SkBitmap bitmap = windowShim_->panel()->GetCurrentPageIcon(); | 580 SkBitmap bitmap = windowShim_->panel()->GetCurrentPageIcon(); |
| 581 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
581 NSImage* iconImage = bitmap.isNull() ? | 582 NSImage* iconImage = bitmap.isNull() ? |
582 gfx::GetCachedImageWithName(@"nav.pdf") : | 583 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) : |
583 gfx::SkBitmapToNSImageWithColorSpace(bitmap, | 584 gfx::SkBitmapToNSImageWithColorSpace(bitmap, |
584 base::mac::GetSystemColorSpace()); | 585 base::mac::GetSystemColorSpace()); |
585 NSImageView* iconView = | 586 NSImageView* iconView = |
586 [[[NSImageView alloc] initWithFrame:iconFrame] autorelease]; | 587 [[[NSImageView alloc] initWithFrame:iconFrame] autorelease]; |
587 [iconView setImage:iconImage]; | 588 [iconView setImage:iconImage]; |
588 icon = iconView; | 589 icon = iconView; |
589 } | 590 } |
590 | 591 |
591 [titlebar_view_ setIcon:icon]; | 592 [titlebar_view_ setIcon:icon]; |
592 } | 593 } |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 1045 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
1045 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 1046 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
1046 fromView:nil]; | 1047 fromView:nil]; |
1047 contentRect.size.height -= panel::kTitlebarHeight; | 1048 contentRect.size.height -= panel::kTitlebarHeight; |
1048 if (contentRect.size.height < 0) | 1049 if (contentRect.size.height < 0) |
1049 contentRect.size.height = 0; | 1050 contentRect.size.height = 0; |
1050 return contentRect; | 1051 return contentRect; |
1051 } | 1052 } |
1052 | 1053 |
1053 @end | 1054 @end |
OLD | NEW |