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

Side by Side Diff: chrome/browser/ui/panels/panel_window_controller_cocoa.mm

Issue 10827259: Change panels to use gfx::Image instead of SkBitmap for favicon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile fix Created 8 years, 4 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) 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 20 matching lines...) Expand all
31 #include "chrome/browser/ui/panels/panel_manager.h" 31 #include "chrome/browser/ui/panels/panel_manager.h"
32 #include "chrome/browser/ui/panels/panel_strip.h" 32 #include "chrome/browser/ui/panels/panel_strip.h"
33 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" 33 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h"
34 #import "chrome/browser/ui/panels/panel_utils_cocoa.h" 34 #import "chrome/browser/ui/panels/panel_utils_cocoa.h"
35 #include "chrome/browser/ui/tabs/tab_strip_model.h" 35 #include "chrome/browser/ui/tabs/tab_strip_model.h"
36 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 36 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
37 #include "content/public/browser/render_widget_host_view.h" 37 #include "content/public/browser/render_widget_host_view.h"
38 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
40 #include "grit/ui_resources.h" 40 #include "grit/ui_resources.h"
41 #include "skia/ext/skia_utils_mac.h"
42 #include "ui/base/resource/resource_bundle.h" 41 #include "ui/base/resource/resource_bundle.h"
43 #include "ui/gfx/image/image.h" 42 #include "ui/gfx/image/image.h"
44 #include "webkit/glue/webcursor.h" 43 #include "webkit/glue/webcursor.h"
45 44
46 using content::WebContents; 45 using content::WebContents;
47 46
48 const int kMinimumWindowSize = 1; 47 const int kMinimumWindowSize = 1;
49 const double kBoundsAnimationSpeedPixelsPerSecond = 1000; 48 const double kBoundsAnimationSpeedPixelsPerSecond = 1000;
50 const double kBoundsAnimationMaxDurationSeconds = 0.18; 49 const double kBoundsAnimationMaxDurationSeconds = 0.18;
51 50
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 if (throbberShouldSpin_) { 554 if (throbberShouldSpin_) {
556 // If the throbber is spinning now, no need to replace it. 555 // If the throbber is spinning now, no need to replace it.
557 if ([[titlebar_view_ icon] isKindOfClass:[ThrobberView class]]) 556 if ([[titlebar_view_ icon] isKindOfClass:[ThrobberView class]])
558 return; 557 return;
559 558
560 NSImage* iconImage = 559 NSImage* iconImage =
561 ResourceBundle::GetSharedInstance().GetNativeImageNamed(IDR_THROBBER); 560 ResourceBundle::GetSharedInstance().GetNativeImageNamed(IDR_THROBBER);
562 icon = [ThrobberView filmstripThrobberViewWithFrame:iconFrame 561 icon = [ThrobberView filmstripThrobberViewWithFrame:iconFrame
563 image:iconImage]; 562 image:iconImage];
564 } else { 563 } else {
565 SkBitmap bitmap = windowShim_->panel()->GetCurrentPageIcon(); 564 gfx::Image page_icon = windowShim_->panel()->GetCurrentPageIcon();
566 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 565 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
567 NSImage* iconImage = bitmap.isNull() ? 566 NSImage* iconImage = page_icon.IsEmpty() ?
568 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) : 567 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) : page_icon.ToNSImage();
569 gfx::SkBitmapToNSImageWithColorSpace(bitmap,
570 base::mac::GetSystemColorSpace());
571 NSImageView* iconView = 568 NSImageView* iconView =
572 [[[NSImageView alloc] initWithFrame:iconFrame] autorelease]; 569 [[[NSImageView alloc] initWithFrame:iconFrame] autorelease];
573 [iconView setImage:iconImage]; 570 [iconView setImage:iconImage];
574 icon = iconView; 571 icon = iconView;
575 } 572 }
576 573
577 [titlebar_view_ setIcon:icon]; 574 [titlebar_view_ setIcon:icon];
578 } 575 }
579 576
580 - (void)updateThrobber:(BOOL)shouldSpin { 577 - (void)updateThrobber:(BOOL)shouldSpin {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { 1027 - (NSRect)contentRectForFrameRect:(NSRect)frameRect {
1031 NSRect contentRect = [[[self window] contentView] convertRect:frameRect 1028 NSRect contentRect = [[[self window] contentView] convertRect:frameRect
1032 fromView:nil]; 1029 fromView:nil];
1033 contentRect.size.height -= panel::kTitlebarHeight; 1030 contentRect.size.height -= panel::kTitlebarHeight;
1034 if (contentRect.size.height < 0) 1031 if (contentRect.size.height < 0)
1035 contentRect.size.height = 0; 1032 contentRect.size.height = 0;
1036 return contentRect; 1033 return contentRect;
1037 } 1034 }
1038 1035
1039 @end 1036 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698