| 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 "chrome/browser/extensions/api/management/chrome_management_api_delegat
e.h" | 5 #include "chrome/browser/extensions/api/management/chrome_management_api_delegat
e.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 extensions::ManagementUninstallFunctionBase* function, | 235 extensions::ManagementUninstallFunctionBase* function, |
| 236 const extensions::Extension* target_extension, | 236 const extensions::Extension* target_extension, |
| 237 bool show_programmatic_uninstall_ui) const { | 237 bool show_programmatic_uninstall_ui) const { |
| 238 return std::unique_ptr<extensions::UninstallDialogDelegate>( | 238 return std::unique_ptr<extensions::UninstallDialogDelegate>( |
| 239 new ManagementUninstallFunctionUninstallDialogDelegate( | 239 new ManagementUninstallFunctionUninstallDialogDelegate( |
| 240 function, target_extension, show_programmatic_uninstall_ui)); | 240 function, target_extension, show_programmatic_uninstall_ui)); |
| 241 } | 241 } |
| 242 | 242 |
| 243 bool ChromeManagementAPIDelegate::CreateAppShortcutFunctionDelegate( | 243 bool ChromeManagementAPIDelegate::CreateAppShortcutFunctionDelegate( |
| 244 extensions::ManagementCreateAppShortcutFunction* function, | 244 extensions::ManagementCreateAppShortcutFunction* function, |
| 245 const extensions::Extension* extension) const { | 245 const extensions::Extension* extension, |
| 246 std::string* error) const { |
| 246 Browser* browser = chrome::FindBrowserWithProfile( | 247 Browser* browser = chrome::FindBrowserWithProfile( |
| 247 Profile::FromBrowserContext(function->browser_context())); | 248 Profile::FromBrowserContext(function->browser_context())); |
| 248 if (!browser) { | 249 if (!browser) { |
| 249 // Shouldn't happen if we have user gesture. | 250 // Shouldn't happen if we have user gesture. |
| 250 function->SetError( | 251 *error = extension_management_api_constants::kNoBrowserToCreateShortcut; |
| 251 extension_management_api_constants::kNoBrowserToCreateShortcut); | |
| 252 return false; | 252 return false; |
| 253 } | 253 } |
| 254 | 254 |
| 255 chrome::ShowCreateChromeAppShortcutsDialog( | 255 chrome::ShowCreateChromeAppShortcutsDialog( |
| 256 browser->window()->GetNativeWindow(), browser->profile(), extension, | 256 browser->window()->GetNativeWindow(), browser->profile(), extension, |
| 257 base::Bind(&extensions::ManagementCreateAppShortcutFunction:: | 257 base::Bind(&extensions::ManagementCreateAppShortcutFunction:: |
| 258 OnCloseShortcutPrompt, | 258 OnCloseShortcutPrompt, |
| 259 function)); | 259 function)); |
| 260 | 260 |
| 261 return true; | 261 return true; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 GURL ChromeManagementAPIDelegate::GetIconURL( | 337 GURL ChromeManagementAPIDelegate::GetIconURL( |
| 338 const extensions::Extension* extension, | 338 const extensions::Extension* extension, |
| 339 int icon_size, | 339 int icon_size, |
| 340 ExtensionIconSet::MatchType match, | 340 ExtensionIconSet::MatchType match, |
| 341 bool grayscale, | 341 bool grayscale, |
| 342 bool* exists) const { | 342 bool* exists) const { |
| 343 return extensions::ExtensionIconSource::GetIconURL(extension, icon_size, | 343 return extensions::ExtensionIconSource::GetIconURL(extension, icon_size, |
| 344 match, grayscale, exists); | 344 match, grayscale, exists); |
| 345 } | 345 } |
| OLD | NEW |