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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 | 437 |
438 bool DeveloperPrivateReloadFunction::RunImpl() { | 438 bool DeveloperPrivateReloadFunction::RunImpl() { |
439 std::string extension_id; | 439 std::string extension_id; |
440 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); | 440 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); |
441 ExtensionService* service = profile()->GetExtensionService(); | 441 ExtensionService* service = profile()->GetExtensionService(); |
442 CHECK(!extension_id.empty()); | 442 CHECK(!extension_id.empty()); |
443 service->ReloadExtension(extension_id); | 443 service->ReloadExtension(extension_id); |
444 return true; | 444 return true; |
445 } | 445 } |
446 | 446 |
447 bool DeveloperPrivatePermissionsFunction::RunImpl() { | |
448 std::string extension_id; | |
449 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); | |
450 ExtensionService* service = profile()->GetExtensionService(); | |
451 CHECK(!extension_id.empty()); | |
452 ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile()); | |
453 DCHECK(registry); | |
454 ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost( | |
455 render_view_host()); | |
456 prompt_.reset(new ExtensionPermissionsPrompt(shell_window->web_contents())); | |
457 const Extension* extension = service->GetInstalledExtension(extension_id); | |
asargent_no_longer_on_chrome
2013/03/20 21:46:30
You should handle the case of |extension| coming b
Gaurav
2013/03/27 19:06:44
Done.
| |
458 // Released by InstallUIAbort. | |
459 AddRef(); | |
460 prompt_->PermissionsDialog(this, extension); | |
461 return true; | |
462 } | |
463 | |
447 DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {} | 464 DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {} |
448 | 465 |
466 void DeveloperPrivatePermissionsFunction::InstallUIProceed() { | |
467 // The permissions dialog only contains a close button. | |
468 NOTREACHED(); | |
469 } | |
470 | |
471 void DeveloperPrivatePermissionsFunction::InstallUIAbort(bool user_initiated) { | |
472 Release(); | |
asargent_no_longer_on_chrome
2013/03/20 21:46:30
You need to call SendResponse() here, before the R
Gaurav
2013/03/27 19:06:44
Done.
| |
473 } | |
474 | |
475 DeveloperPrivatePermissionsFunction::DeveloperPrivatePermissionsFunction() {} | |
476 | |
477 DeveloperPrivatePermissionsFunction::~DeveloperPrivatePermissionsFunction() {} | |
478 | |
449 bool DeveloperPrivateRestartFunction::RunImpl() { | 479 bool DeveloperPrivateRestartFunction::RunImpl() { |
450 std::string extension_id; | 480 std::string extension_id; |
451 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); | 481 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); |
452 ExtensionService* service = profile()->GetExtensionService(); | 482 ExtensionService* service = profile()->GetExtensionService(); |
453 EXTENSION_FUNCTION_VALIDATE(!extension_id.empty()); | 483 EXTENSION_FUNCTION_VALIDATE(!extension_id.empty()); |
454 service->RestartExtension(extension_id); | 484 service->RestartExtension(extension_id); |
455 return true; | 485 return true; |
456 } | 486 } |
457 | 487 |
458 DeveloperPrivateRestartFunction::~DeveloperPrivateRestartFunction() {} | 488 DeveloperPrivateRestartFunction::~DeveloperPrivateRestartFunction() {} |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
843 | 873 |
844 #undef SET_STRING | 874 #undef SET_STRING |
845 return true; | 875 return true; |
846 } | 876 } |
847 | 877 |
848 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} | 878 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} |
849 | 879 |
850 } // namespace api | 880 } // namespace api |
851 | 881 |
852 } // namespace extensions | 882 } // namespace extensions |
OLD | NEW |