OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "apps/app_window.h" | 5 #include "apps/app_window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "extensions/browser/extensions_browser_client.h" | 40 #include "extensions/browser/extensions_browser_client.h" |
41 #include "extensions/browser/notification_types.h" | 41 #include "extensions/browser/notification_types.h" |
42 #include "extensions/browser/process_manager.h" | 42 #include "extensions/browser/process_manager.h" |
43 #include "extensions/browser/suggest_permission_util.h" | 43 #include "extensions/browser/suggest_permission_util.h" |
44 #include "extensions/browser/view_type_utils.h" | 44 #include "extensions/browser/view_type_utils.h" |
45 #include "extensions/common/draggable_region.h" | 45 #include "extensions/common/draggable_region.h" |
46 #include "extensions/common/extension.h" | 46 #include "extensions/common/extension.h" |
47 #include "extensions/common/manifest_handlers/icons_handler.h" | 47 #include "extensions/common/manifest_handlers/icons_handler.h" |
48 #include "extensions/common/permissions/permissions_data.h" | 48 #include "extensions/common/permissions/permissions_data.h" |
49 #include "extensions/common/switches.h" | 49 #include "extensions/common/switches.h" |
50 #include "grit/theme_resources.h" | |
51 #include "third_party/skia/include/core/SkRegion.h" | 50 #include "third_party/skia/include/core/SkRegion.h" |
52 #include "ui/base/resource/resource_bundle.h" | |
53 #include "ui/gfx/screen.h" | 51 #include "ui/gfx/screen.h" |
54 | 52 |
55 #if !defined(OS_MACOSX) | 53 #if !defined(OS_MACOSX) |
56 #include "apps/pref_names.h" | 54 #include "apps/pref_names.h" |
57 #include "base/prefs/pref_service.h" | 55 #include "base/prefs/pref_service.h" |
58 #endif | 56 #endif |
59 | 57 |
60 using content::BrowserContext; | 58 using content::BrowserContext; |
61 using content::ConsoleMessageLevel; | 59 using content::ConsoleMessageLevel; |
62 using content::WebContents; | 60 using content::WebContents; |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 void AppWindow::OnExtensionIconImageChanged(extensions::IconImage* image) { | 806 void AppWindow::OnExtensionIconImageChanged(extensions::IconImage* image) { |
809 DCHECK_EQ(app_icon_image_.get(), image); | 807 DCHECK_EQ(app_icon_image_.get(), image); |
810 | 808 |
811 UpdateAppIcon(gfx::Image(app_icon_image_->image_skia())); | 809 UpdateAppIcon(gfx::Image(app_icon_image_->image_skia())); |
812 } | 810 } |
813 | 811 |
814 void AppWindow::UpdateExtensionAppIcon() { | 812 void AppWindow::UpdateExtensionAppIcon() { |
815 // Avoid using any previous app icons were being downloaded. | 813 // Avoid using any previous app icons were being downloaded. |
816 image_loader_ptr_factory_.InvalidateWeakPtrs(); | 814 image_loader_ptr_factory_.InvalidateWeakPtrs(); |
817 | 815 |
818 const gfx::ImageSkia& default_icon = | |
819 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | |
820 IDR_APP_DEFAULT_ICON); | |
821 | |
822 const extensions::Extension* extension = GetExtension(); | 816 const extensions::Extension* extension = GetExtension(); |
823 if (!extension) | 817 if (!extension) |
824 return; | 818 return; |
825 | 819 |
826 app_icon_image_.reset( | 820 app_icon_image_.reset( |
827 new extensions::IconImage(browser_context(), | 821 new extensions::IconImage(browser_context(), |
828 extension, | 822 extension, |
829 extensions::IconsInfo::GetIcons(extension), | 823 extensions::IconsInfo::GetIcons(extension), |
830 app_delegate_->PreferredIconSize(), | 824 app_delegate_->PreferredIconSize(), |
831 default_icon, | 825 app_delegate_->GetAppDefaultIcon(), |
832 this)); | 826 this)); |
833 | 827 |
834 // Triggers actual image loading with 1x resources. The 2x resource will | 828 // Triggers actual image loading with 1x resources. The 2x resource will |
835 // be handled by IconImage class when requested. | 829 // be handled by IconImage class when requested. |
836 app_icon_image_->image_skia().GetRepresentation(1.0f); | 830 app_icon_image_->image_skia().GetRepresentation(1.0f); |
837 } | 831 } |
838 | 832 |
839 void AppWindow::SetNativeWindowFullscreen() { | 833 void AppWindow::SetNativeWindowFullscreen() { |
840 native_app_window_->SetFullscreen(fullscreen_types_); | 834 native_app_window_->SetFullscreen(fullscreen_types_); |
841 | 835 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 region.bounds.x(), | 1098 region.bounds.x(), |
1105 region.bounds.y(), | 1099 region.bounds.y(), |
1106 region.bounds.right(), | 1100 region.bounds.right(), |
1107 region.bounds.bottom(), | 1101 region.bounds.bottom(), |
1108 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1102 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1109 } | 1103 } |
1110 return sk_region; | 1104 return sk_region; |
1111 } | 1105 } |
1112 | 1106 |
1113 } // namespace apps | 1107 } // namespace apps |
OLD | NEW |