| 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/frame/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_dll_resource.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/themes/theme_properties.h" | 14 #include "chrome/browser/themes/theme_properties.h" |
| 13 #include "chrome/browser/ui/layout_constants.h" | 15 #include "chrome/browser/ui/layout_constants.h" |
| 14 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 15 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 17 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
| 16 #include "chrome/browser/ui/views/tabs/tab.h" | 18 #include "chrome/browser/ui/views/tabs/tab.h" |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 base::win::ScopedHICON previous_small_icon; | 603 base::win::ScopedHICON previous_small_icon; |
| 602 base::win::ScopedHICON previous_big_icon; | 604 base::win::ScopedHICON previous_big_icon; |
| 603 HICON small_icon = nullptr; | 605 HICON small_icon = nullptr; |
| 604 HICON big_icon = nullptr; | 606 HICON big_icon = nullptr; |
| 605 | 607 |
| 606 // Check if hosted BrowserView has a window icon to use. | 608 // Check if hosted BrowserView has a window icon to use. |
| 607 if (browser_view()->ShouldShowWindowIcon()) { | 609 if (browser_view()->ShouldShowWindowIcon()) { |
| 608 gfx::ImageSkia icon = browser_view()->GetWindowIcon(); | 610 gfx::ImageSkia icon = browser_view()->GetWindowIcon(); |
| 609 if (!icon.isNull()) { | 611 if (!icon.isNull()) { |
| 610 // Keep previous icons alive as long as they are referenced by the HWND. | 612 // Keep previous icons alive as long as they are referenced by the HWND. |
| 611 previous_small_icon = small_window_icon_.Pass(); | 613 previous_small_icon = std::move(small_window_icon_); |
| 612 previous_big_icon = big_window_icon_.Pass(); | 614 previous_big_icon = std::move(big_window_icon_); |
| 613 | 615 |
| 614 // Take responsibility for eventually destroying the created icons. | 616 // Take responsibility for eventually destroying the created icons. |
| 615 small_window_icon_ = | 617 small_window_icon_ = CreateHICONFromSkBitmapSizedTo( |
| 616 CreateHICONFromSkBitmapSizedTo(icon, GetSystemMetrics(SM_CXSMICON), | 618 icon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); |
| 617 GetSystemMetrics(SM_CYSMICON)) | 619 big_window_icon_ = CreateHICONFromSkBitmapSizedTo( |
| 618 .Pass(); | 620 icon, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); |
| 619 big_window_icon_ = | |
| 620 CreateHICONFromSkBitmapSizedTo(icon, GetSystemMetrics(SM_CXICON), | |
| 621 GetSystemMetrics(SM_CYICON)) | |
| 622 .Pass(); | |
| 623 | 621 |
| 624 small_icon = small_window_icon_.get(); | 622 small_icon = small_window_icon_.get(); |
| 625 big_icon = big_window_icon_.get(); | 623 big_icon = big_window_icon_.get(); |
| 626 } | 624 } |
| 627 } | 625 } |
| 628 | 626 |
| 629 // Fallback to class icon. | 627 // Fallback to class icon. |
| 630 if (!small_icon) { | 628 if (!small_icon) { |
| 631 small_icon = reinterpret_cast<HICON>( | 629 small_icon = reinterpret_cast<HICON>( |
| 632 GetClassLongPtr(views::HWNDForWidget(frame()), GCLP_HICONSM)); | 630 GetClassLongPtr(views::HWNDForWidget(frame()), GCLP_HICONSM)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 661 static bool initialized = false; | 659 static bool initialized = false; |
| 662 if (!initialized) { | 660 if (!initialized) { |
| 663 for (int i = 0; i < kThrobberIconCount; ++i) { | 661 for (int i = 0; i < kThrobberIconCount; ++i) { |
| 664 throbber_icons_[i] = | 662 throbber_icons_[i] = |
| 665 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 663 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
| 666 DCHECK(throbber_icons_[i]); | 664 DCHECK(throbber_icons_[i]); |
| 667 } | 665 } |
| 668 initialized = true; | 666 initialized = true; |
| 669 } | 667 } |
| 670 } | 668 } |
| OLD | NEW |