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/views/tab_icon_view.h" | 5 #include "chrome/browser/ui/views/tab_icon_view.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
8 #include <windows.h> | 10 #include <windows.h> |
9 #include <shellapi.h> | 11 #include <shellapi.h> |
10 #endif | 12 #endif |
11 | 13 |
12 #include "base/logging.h" | 14 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
15 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
16 #include "chrome/browser/ui/views/tab_icon_view_model.h" | 17 #include "chrome/browser/ui/views/tab_icon_view_model.h" |
17 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/base/theme_provider.h" | 20 #include "ui/base/theme_provider.h" |
20 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
21 #include "ui/gfx/favicon_size.h" | 22 #include "ui/gfx/favicon_size.h" |
22 #include "ui/gfx/paint_throbber.h" | 23 #include "ui/gfx/paint_throbber.h" |
23 #include "ui/native_theme/native_theme.h" | 24 #include "ui/native_theme/native_theme.h" |
(...skipping 13 matching lines...) Expand all Loading... |
37 | 38 |
38 // static | 39 // static |
39 void TabIconView::InitializeIfNeeded() { | 40 void TabIconView::InitializeIfNeeded() { |
40 if (!g_initialized) { | 41 if (!g_initialized) { |
41 g_initialized = true; | 42 g_initialized = true; |
42 | 43 |
43 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
44 // The default window icon is the application icon, not the default | 45 // The default window icon is the application icon, not the default |
45 // favicon. | 46 // favicon. |
46 HICON app_icon = GetAppIcon(); | 47 HICON app_icon = GetAppIcon(); |
47 scoped_ptr<SkBitmap> bitmap( | 48 std::unique_ptr<SkBitmap> bitmap( |
48 IconUtil::CreateSkBitmapFromHICON(app_icon, gfx::Size(16, 16))); | 49 IconUtil::CreateSkBitmapFromHICON(app_icon, gfx::Size(16, 16))); |
49 g_default_favicon = new gfx::ImageSkia(gfx::ImageSkiaRep(*bitmap, 1.0f)); | 50 g_default_favicon = new gfx::ImageSkia(gfx::ImageSkiaRep(*bitmap, 1.0f)); |
50 DestroyIcon(app_icon); | 51 DestroyIcon(app_icon); |
51 #else | 52 #else |
52 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 53 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
53 g_default_favicon = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16); | 54 g_default_favicon = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16); |
54 #endif | 55 #endif |
55 } | 56 } |
56 } | 57 } |
57 | 58 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 gfx::ImageSkia favicon = model_->GetFaviconForTabIconView(); | 132 gfx::ImageSkia favicon = model_->GetFaviconForTabIconView(); |
132 if (!favicon.isNull()) { | 133 if (!favicon.isNull()) { |
133 rendered = true; | 134 rendered = true; |
134 PaintFavicon(canvas, favicon); | 135 PaintFavicon(canvas, favicon); |
135 } | 136 } |
136 } | 137 } |
137 | 138 |
138 if (!rendered) | 139 if (!rendered) |
139 PaintFavicon(canvas, *g_default_favicon); | 140 PaintFavicon(canvas, *g_default_favicon); |
140 } | 141 } |
OLD | NEW |