| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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" |
| 11 #include "chrome/browser/devtools/devtools_window.h" | 11 #include "chrome/browser/devtools/devtools_window.h" |
| 12 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 12 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| 13 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" | 13 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" |
| 14 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" | 14 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/extensions/extension_system.h" | 16 #include "chrome/browser/extensions/extension_system.h" |
| 17 #include "chrome/browser/extensions/extension_tab_util.h" | 17 #include "chrome/browser/extensions/extension_tab_util.h" |
| 18 #include "chrome/browser/extensions/window_controller.h" | 18 #include "chrome/browser/extensions/window_controller.h" |
| 19 #include "chrome/browser/extensions/window_controller_list.h" | 19 #include "chrome/browser/extensions/window_controller_list.h" |
| 20 #include "chrome/browser/lifetime/application_lifetime.h" | 20 #include "chrome/browser/lifetime/application_lifetime.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/themes/theme_service.h" | 22 #include "chrome/browser/themes/theme_service.h" |
| 23 #include "chrome/browser/themes/theme_service_factory.h" | 23 #include "chrome/browser/themes/theme_service_factory.h" |
| 24 #include "chrome/browser/ui/panels/native_panel.h" | 24 #include "chrome/browser/ui/panels/native_panel.h" |
| 25 #include "chrome/browser/ui/panels/panel_collection.h" | 25 #include "chrome/browser/ui/panels/panel_collection.h" |
| 26 #include "chrome/browser/ui/panels/panel_host.h" | 26 #include "chrome/browser/ui/panels/panel_host.h" |
| 27 #include "chrome/browser/ui/panels/panel_manager.h" | 27 #include "chrome/browser/ui/panels/panel_manager.h" |
| 28 #include "chrome/browser/ui/panels/stacked_panel_collection.h" | 28 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
| 29 #include "chrome/browser/web_applications/web_app.h" | 29 #include "chrome/browser/web_applications/web_app.h" |
| 30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
| 31 #include "chrome/common/extensions/api/icons/icons_handler.h" |
| 31 #include "chrome/common/extensions/extension.h" | 32 #include "chrome/common/extensions/extension.h" |
| 32 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
| 34 #include "content/public/browser/notification_types.h" | 35 #include "content/public/browser/notification_types.h" |
| 35 #include "content/public/browser/render_view_host.h" | 36 #include "content/public/browser/render_view_host.h" |
| 36 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
| 37 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 38 #include "ui/gfx/image/image.h" | 39 #include "ui/gfx/image/image.h" |
| 39 #include "ui/gfx/rect.h" | 40 #include "ui/gfx/rect.h" |
| 40 | 41 |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 } | 831 } |
| 831 | 832 |
| 832 void Panel::UpdateAppIcon() { | 833 void Panel::UpdateAppIcon() { |
| 833 const extensions::Extension* extension = GetExtension(); | 834 const extensions::Extension* extension = GetExtension(); |
| 834 if (!extension) | 835 if (!extension) |
| 835 return; | 836 return; |
| 836 | 837 |
| 837 app_icon_loader_.reset(new ImageLoadingTracker(this)); | 838 app_icon_loader_.reset(new ImageLoadingTracker(this)); |
| 838 app_icon_loader_->LoadImage( | 839 app_icon_loader_->LoadImage( |
| 839 extension, | 840 extension, |
| 840 extension->GetIconResource(extension_misc::EXTENSION_ICON_SMALL, | 841 extensions::IconsInfo::GetIconResource( |
| 841 ExtensionIconSet::MATCH_BIGGER), | 842 extension, |
| 843 extension_misc::EXTENSION_ICON_SMALL, |
| 844 ExtensionIconSet::MATCH_BIGGER), |
| 842 gfx::Size(extension_misc::EXTENSION_ICON_SMALL, | 845 gfx::Size(extension_misc::EXTENSION_ICON_SMALL, |
| 843 extension_misc::EXTENSION_ICON_SMALL), | 846 extension_misc::EXTENSION_ICON_SMALL), |
| 844 ImageLoadingTracker::CACHE); | 847 ImageLoadingTracker::CACHE); |
| 845 } | 848 } |
| 846 | 849 |
| 847 void Panel::OnImageLoaded(const gfx::Image& image, | 850 void Panel::OnImageLoaded(const gfx::Image& image, |
| 848 const std::string& extension_id, | 851 const std::string& extension_id, |
| 849 int index) { | 852 int index) { |
| 850 if (!image.IsEmpty()) { | 853 if (!image.IsEmpty()) { |
| 851 app_icon_ = image; | 854 app_icon_ = image; |
| 852 native_panel_->UpdatePanelTitleBar(); | 855 native_panel_->UpdatePanelTitleBar(); |
| 853 } | 856 } |
| 854 app_icon_loader_.reset(); | 857 app_icon_loader_.reset(); |
| 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 |