| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 566 |
| 567 - (void)updateIcon { | 567 - (void)updateIcon { |
| 568 NSView* icon = nil; | 568 NSView* icon = nil; |
| 569 NSRect iconFrame = [[titlebar_view_ icon] frame]; | 569 NSRect iconFrame = [[titlebar_view_ icon] frame]; |
| 570 if (throbberShouldSpin_) { | 570 if (throbberShouldSpin_) { |
| 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( |
| 577 IDR_THROBBER).ToNSImage(); |
| 577 icon = [ThrobberView filmstripThrobberViewWithFrame:iconFrame | 578 icon = [ThrobberView filmstripThrobberViewWithFrame:iconFrame |
| 578 image:iconImage]; | 579 image:iconImage]; |
| 579 } else { | 580 } else { |
| 580 gfx::Image page_icon = windowShim_->panel()->GetCurrentPageIcon(); | 581 const gfx::Image& page_icon = windowShim_->panel()->GetCurrentPageIcon(); |
| 581 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 582 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 582 NSImage* iconImage = page_icon.IsEmpty() ? | 583 NSImage* iconImage = page_icon.IsEmpty() ? |
| 583 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) : page_icon.ToNSImage(); | 584 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToNSImage() : |
| 585 page_icon.ToNSImage(); |
| 584 NSImageView* iconView = | 586 NSImageView* iconView = |
| 585 [[[NSImageView alloc] initWithFrame:iconFrame] autorelease]; | 587 [[[NSImageView alloc] initWithFrame:iconFrame] autorelease]; |
| 586 [iconView setImage:iconImage]; | 588 [iconView setImage:iconImage]; |
| 587 icon = iconView; | 589 icon = iconView; |
| 588 } | 590 } |
| 589 | 591 |
| 590 [titlebar_view_ setIcon:icon]; | 592 [titlebar_view_ setIcon:icon]; |
| 591 } | 593 } |
| 592 | 594 |
| 593 - (void)updateThrobber:(BOOL)shouldSpin { | 595 - (void)updateThrobber:(BOOL)shouldSpin { |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 1018 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
| 1017 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 1019 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
| 1018 fromView:nil]; | 1020 fromView:nil]; |
| 1019 contentRect.size.height -= panel::kTitlebarHeight; | 1021 contentRect.size.height -= panel::kTitlebarHeight; |
| 1020 if (contentRect.size.height < 0) | 1022 if (contentRect.size.height < 0) |
| 1021 contentRect.size.height = 0; | 1023 contentRect.size.height = 0; |
| 1022 return contentRect; | 1024 return contentRect; |
| 1023 } | 1025 } |
| 1024 | 1026 |
| 1025 @end | 1027 @end |
| OLD | NEW |