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/api/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 bool DeveloperPrivateReloadFunction::RunImpl() { | 439 bool DeveloperPrivateReloadFunction::RunImpl() { |
440 scoped_ptr<Reload::Params> params(Reload::Params::Create(*args_)); | 440 scoped_ptr<Reload::Params> params(Reload::Params::Create(*args_)); |
441 EXTENSION_FUNCTION_VALIDATE(params.get()); | 441 EXTENSION_FUNCTION_VALIDATE(params.get()); |
442 | 442 |
443 ExtensionService* service = profile()->GetExtensionService(); | 443 ExtensionService* service = profile()->GetExtensionService(); |
444 CHECK(!params->item_id.empty()); | 444 CHECK(!params->item_id.empty()); |
445 service->ReloadExtension(params->item_id); | 445 service->ReloadExtension(params->item_id); |
446 return true; | 446 return true; |
447 } | 447 } |
448 | 448 |
| 449 bool DeveloperPrivateShowPermissionsDialogFunction::RunImpl() { |
| 450 std::string extension_id; |
| 451 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); |
| 452 ExtensionService* service = profile()->GetExtensionService(); |
| 453 CHECK(!extension_id.empty()); |
| 454 ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile()); |
| 455 DCHECK(registry); |
| 456 ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost( |
| 457 render_view_host()); |
| 458 prompt_.reset(new ExtensionInstallPrompt(shell_window->web_contents())); |
| 459 const Extension* extension = service->GetInstalledExtension(extension_id); |
| 460 |
| 461 if (!extension) |
| 462 return false; |
| 463 |
| 464 // Released by InstallUIAbort. |
| 465 AddRef(); |
| 466 prompt_->ReviewPermissions(this, extension); |
| 467 return true; |
| 468 } |
| 469 |
449 DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {} | 470 DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {} |
450 | 471 |
| 472 void DeveloperPrivateShowPermissionsDialogFunction::InstallUIProceed() { |
| 473 // The permissions dialog only contains a close button. |
| 474 NOTREACHED(); |
| 475 } |
| 476 |
| 477 void DeveloperPrivateShowPermissionsDialogFunction::InstallUIAbort( |
| 478 bool user_initiated) { |
| 479 SendResponse(true); |
| 480 Release(); |
| 481 } |
| 482 |
| 483 DeveloperPrivateShowPermissionsDialogFunction:: |
| 484 DeveloperPrivateShowPermissionsDialogFunction() {} |
| 485 |
| 486 DeveloperPrivateShowPermissionsDialogFunction:: |
| 487 ~DeveloperPrivateShowPermissionsDialogFunction() {} |
| 488 |
451 bool DeveloperPrivateRestartFunction::RunImpl() { | 489 bool DeveloperPrivateRestartFunction::RunImpl() { |
452 scoped_ptr<Restart::Params> params(Restart::Params::Create(*args_)); | 490 scoped_ptr<Restart::Params> params(Restart::Params::Create(*args_)); |
453 EXTENSION_FUNCTION_VALIDATE(params.get()); | 491 EXTENSION_FUNCTION_VALIDATE(params.get()); |
454 | 492 |
455 ExtensionService* service = profile()->GetExtensionService(); | 493 ExtensionService* service = profile()->GetExtensionService(); |
456 EXTENSION_FUNCTION_VALIDATE(!params->item_id.empty()); | 494 EXTENSION_FUNCTION_VALIDATE(!params->item_id.empty()); |
457 service->RestartExtension(params->item_id); | 495 service->RestartExtension(params->item_id); |
458 return true; | 496 return true; |
459 } | 497 } |
460 | 498 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 | 885 |
848 #undef SET_STRING | 886 #undef SET_STRING |
849 return true; | 887 return true; |
850 } | 888 } |
851 | 889 |
852 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} | 890 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} |
853 | 891 |
854 } // namespace api | 892 } // namespace api |
855 | 893 |
856 } // namespace extensions | 894 } // namespace extensions |
OLD | NEW |