| 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.h" | 5 #include "chrome/browser/ui/panels/panel.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/themes/theme_service.h" | 23 #include "chrome/browser/themes/theme_service.h" |
| 24 #include "chrome/browser/themes/theme_service_factory.h" | 24 #include "chrome/browser/themes/theme_service_factory.h" |
| 25 #include "chrome/browser/ui/panels/native_panel.h" | 25 #include "chrome/browser/ui/panels/native_panel.h" |
| 26 #include "chrome/browser/ui/panels/panel_collection.h" | 26 #include "chrome/browser/ui/panels/panel_collection.h" |
| 27 #include "chrome/browser/ui/panels/panel_host.h" | 27 #include "chrome/browser/ui/panels/panel_host.h" |
| 28 #include "chrome/browser/ui/panels/panel_manager.h" | 28 #include "chrome/browser/ui/panels/panel_manager.h" |
| 29 #include "chrome/browser/ui/panels/stacked_panel_collection.h" | 29 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
| 30 #include "chrome/browser/web_applications/web_app.h" | 30 #include "chrome/browser/web_applications/web_app.h" |
| 31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
| 32 #include "chrome/common/extensions/api/icons/icons_handler.h" |
| 32 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
| 33 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 34 #include "content/public/browser/notification_source.h" | 35 #include "content/public/browser/notification_source.h" |
| 35 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
| 36 #include "content/public/browser/render_view_host.h" | 37 #include "content/public/browser/render_view_host.h" |
| 37 #include "content/public/browser/user_metrics.h" | 38 #include "content/public/browser/user_metrics.h" |
| 38 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 39 #include "ui/gfx/image/image.h" | 40 #include "ui/gfx/image/image.h" |
| 40 #include "ui/gfx/rect.h" | 41 #include "ui/gfx/rect.h" |
| 41 | 42 |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 } | 833 } |
| 833 | 834 |
| 834 void Panel::UpdateAppIcon() { | 835 void Panel::UpdateAppIcon() { |
| 835 const extensions::Extension* extension = GetExtension(); | 836 const extensions::Extension* extension = GetExtension(); |
| 836 if (!extension) | 837 if (!extension) |
| 837 return; | 838 return; |
| 838 | 839 |
| 839 extensions::ImageLoader* loader = extensions::ImageLoader::Get(profile()); | 840 extensions::ImageLoader* loader = extensions::ImageLoader::Get(profile()); |
| 840 loader->LoadImageAsync( | 841 loader->LoadImageAsync( |
| 841 extension, | 842 extension, |
| 842 extension->GetIconResource(extension_misc::EXTENSION_ICON_SMALL, | 843 extensions::IconsInfo::GetIconResource( |
| 843 ExtensionIconSet::MATCH_BIGGER), | 844 extension, |
| 845 extension_misc::EXTENSION_ICON_SMALL, |
| 846 ExtensionIconSet::MATCH_BIGGER), |
| 844 gfx::Size(extension_misc::EXTENSION_ICON_SMALL, | 847 gfx::Size(extension_misc::EXTENSION_ICON_SMALL, |
| 845 extension_misc::EXTENSION_ICON_SMALL), | 848 extension_misc::EXTENSION_ICON_SMALL), |
| 846 base::Bind(&Panel::OnImageLoaded, | 849 base::Bind(&Panel::OnImageLoaded, |
| 847 image_loader_ptr_factory_.GetWeakPtr())); | 850 image_loader_ptr_factory_.GetWeakPtr())); |
| 848 } | 851 } |
| 849 | 852 |
| 850 void Panel::OnImageLoaded(const gfx::Image& image) { | 853 void Panel::OnImageLoaded(const gfx::Image& image) { |
| 851 if (!image.IsEmpty()) { | 854 if (!image.IsEmpty()) { |
| 852 app_icon_ = image; | 855 app_icon_ = image; |
| 853 native_panel_->UpdatePanelTitleBar(); | 856 native_panel_->UpdatePanelTitleBar(); |
| 854 } | 857 } |
| 855 | 858 |
| 856 content::NotificationService::current()->Notify( | 859 content::NotificationService::current()->Notify( |
| 857 chrome::NOTIFICATION_PANEL_APP_ICON_LOADED, | 860 chrome::NOTIFICATION_PANEL_APP_ICON_LOADED, |
| 858 content::Source<Panel>(this), | 861 content::Source<Panel>(this), |
| 859 content::NotificationService::NoDetails()); | 862 content::NotificationService::NoDetails()); |
| 860 } | 863 } |
| OLD | NEW |