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

Side by Side Diff: chrome/browser/ui/panels/panel.cc

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: License year update Created 7 years, 11 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
OLDNEW
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/web_applications/web_app.h" 28 #include "chrome/browser/web_applications/web_app.h"
29 #include "chrome/common/chrome_notification_types.h" 29 #include "chrome/common/chrome_notification_types.h"
30 #include "chrome/common/extensions/api/icons/icons_handler.h"
30 #include "chrome/common/extensions/extension.h" 31 #include "chrome/common/extensions/extension.h"
31 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
32 #include "content/public/browser/notification_source.h" 33 #include "content/public/browser/notification_source.h"
33 #include "content/public/browser/notification_types.h" 34 #include "content/public/browser/notification_types.h"
34 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/user_metrics.h" 36 #include "content/public/browser/user_metrics.h"
36 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
37 #include "ui/gfx/image/image.h" 38 #include "ui/gfx/image/image.h"
38 #include "ui/gfx/rect.h" 39 #include "ui/gfx/rect.h"
39 40
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 } 819 }
819 820
820 void Panel::UpdateAppIcon() { 821 void Panel::UpdateAppIcon() {
821 const extensions::Extension* extension = GetExtension(); 822 const extensions::Extension* extension = GetExtension();
822 if (!extension) 823 if (!extension)
823 return; 824 return;
824 825
825 app_icon_loader_.reset(new ImageLoadingTracker(this)); 826 app_icon_loader_.reset(new ImageLoadingTracker(this));
826 app_icon_loader_->LoadImage( 827 app_icon_loader_->LoadImage(
827 extension, 828 extension,
828 extension->GetIconResource(extension_misc::EXTENSION_ICON_SMALL, 829 extensions::IconsInfo::GetIconResource(
829 ExtensionIconSet::MATCH_BIGGER), 830 extension,
831 extension_misc::EXTENSION_ICON_SMALL,
832 ExtensionIconSet::MATCH_BIGGER),
830 gfx::Size(extension_misc::EXTENSION_ICON_SMALL, 833 gfx::Size(extension_misc::EXTENSION_ICON_SMALL,
831 extension_misc::EXTENSION_ICON_SMALL), 834 extension_misc::EXTENSION_ICON_SMALL),
832 ImageLoadingTracker::CACHE); 835 ImageLoadingTracker::CACHE);
833 } 836 }
834 837
835 void Panel::OnImageLoaded(const gfx::Image& image, 838 void Panel::OnImageLoaded(const gfx::Image& image,
836 const std::string& extension_id, 839 const std::string& extension_id,
837 int index) { 840 int index) {
838 if (!image.IsEmpty()) { 841 if (!image.IsEmpty()) {
839 app_icon_ = image; 842 app_icon_ = image;
840 native_panel_->UpdatePanelTitleBar(); 843 native_panel_->UpdatePanelTitleBar();
841 } 844 }
842 app_icon_loader_.reset(); 845 app_icon_loader_.reset();
843 846
844 content::NotificationService::current()->Notify( 847 content::NotificationService::current()->Notify(
845 chrome::NOTIFICATION_PANEL_APP_ICON_LOADED, 848 chrome::NOTIFICATION_PANEL_APP_ICON_LOADED,
846 content::Source<Panel>(this), 849 content::Source<Panel>(this),
847 content::NotificationService::NoDetails()); 850 content::NotificationService::NoDetails());
848 } 851 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698