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/extensions/extension_uninstall_dialog.h" | 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/extensions/image_loader.h" | 10 #include "chrome/browser/extensions/image_loader.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
13 #include "chrome/common/extensions/api/icons/icons_handler.h" | 13 #include "chrome/common/extensions/api/icons/icons_handler.h" |
14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
15 #include "chrome/common/extensions/extension_constants.h" | 15 #include "chrome/common/extensions/extension_constants.h" |
16 #include "chrome/common/extensions/extension_icon_set.h" | 16 #include "chrome/common/extensions/extension_icon_set.h" |
17 #include "chrome/common/extensions/extension_resource.h" | |
18 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
19 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
| 19 #include "extensions/common/extension_resource.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
21 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
23 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
24 | 24 |
25 #if defined(ENABLE_MANAGED_USERS) | 25 #if defined(ENABLE_MANAGED_USERS) |
26 #include "chrome/browser/managed_mode/managed_user_service.h" | 26 #include "chrome/browser/managed_mode/managed_user_service.h" |
27 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 27 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
28 #endif | 28 #endif |
29 | 29 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 #if defined(ENABLE_MANAGED_USERS) | 80 #if defined(ENABLE_MANAGED_USERS) |
81 // If the profile belongs to a managed user, and the profile is not in | 81 // If the profile belongs to a managed user, and the profile is not in |
82 // elevated state, a passphrase dialog is shown, and if the custodian | 82 // elevated state, a passphrase dialog is shown, and if the custodian |
83 // authorizes by entering his passphrase, the uninstall is continued by | 83 // authorizes by entering his passphrase, the uninstall is continued by |
84 // calling |ExtensionUninstallAccepted| on the delegate. | 84 // calling |ExtensionUninstallAccepted| on the delegate. |
85 if (ShowAuthorizationDialog()) | 85 if (ShowAuthorizationDialog()) |
86 return; | 86 return; |
87 #endif | 87 #endif |
88 | 88 |
89 ExtensionResource image = extensions::IconsInfo::GetIconResource( | 89 extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource( |
90 extension_, | 90 extension_, |
91 extension_misc::EXTENSION_ICON_LARGE, | 91 extension_misc::EXTENSION_ICON_LARGE, |
92 ExtensionIconSet::MATCH_BIGGER); | 92 ExtensionIconSet::MATCH_BIGGER); |
93 // Load the icon whose pixel size is large enough to be displayed under | 93 // Load the icon whose pixel size is large enough to be displayed under |
94 // maximal supported scale factor. UI code will scale the icon down if needed. | 94 // maximal supported scale factor. UI code will scale the icon down if needed. |
95 int pixel_size = GetSizeForMaxScaleFactor(kIconSize); | 95 int pixel_size = GetSizeForMaxScaleFactor(kIconSize); |
96 | 96 |
97 // Load the image asynchronously. The response will be sent to OnImageLoaded. | 97 // Load the image asynchronously. The response will be sent to OnImageLoaded. |
98 state_ = kImageIsLoading; | 98 state_ = kImageIsLoading; |
99 extensions::ImageLoader* loader = | 99 extensions::ImageLoader* loader = |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 ManagedUserService* service = ManagedUserServiceFactory::GetForProfile( | 165 ManagedUserService* service = ManagedUserServiceFactory::GetForProfile( |
166 profile_); | 166 profile_); |
167 DCHECK(service); | 167 DCHECK(service); |
168 service->AddElevationForExtension(extension_->id()); | 168 service->AddElevationForExtension(extension_->id()); |
169 delegate_->ExtensionUninstallAccepted(); | 169 delegate_->ExtensionUninstallAccepted(); |
170 } else { | 170 } else { |
171 delegate_->ExtensionUninstallCanceled(); | 171 delegate_->ExtensionUninstallCanceled(); |
172 } | 172 } |
173 } | 173 } |
174 #endif | 174 #endif |
OLD | NEW |