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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 result = true; | 402 result = true; |
403 } | 403 } |
404 | 404 |
405 SetResult(Value::CreateBooleanValue(result)); | 405 SetResult(Value::CreateBooleanValue(result)); |
406 return true; | 406 return true; |
407 } | 407 } |
408 | 408 |
409 DeveloperPrivateAllowFileAccessFunction:: | 409 DeveloperPrivateAllowFileAccessFunction:: |
410 ~DeveloperPrivateAllowFileAccessFunction() {} | 410 ~DeveloperPrivateAllowFileAccessFunction() {} |
411 | 411 |
412 bool DeveloperPrivateAllowIncognitoFunction::RunImpl() { | |
413 std::string extension_id; | |
414 bool allow = false; | |
415 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); | |
416 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &allow)); | |
417 | |
418 ExtensionService* service = profile()->GetExtensionService(); | |
419 const Extension* extension = service->GetInstalledExtension(extension_id); | |
420 bool result = true; | |
421 | |
422 if (!extension) { | |
423 result = false; | |
424 } else { | |
425 service->SetIsIncognitoEnabled(extension->id(), allow); | |
426 } | |
427 | |
428 return true; | |
asargent_no_longer_on_chrome
2013/02/25 18:40:30
nit: should you be returning |result| here instead
Gaurav
2013/02/25 21:43:12
Done.
| |
429 } | |
430 | |
431 DeveloperPrivateAllowIncognitoFunction:: | |
432 ~DeveloperPrivateAllowIncognitoFunction() {} | |
433 | |
434 | |
412 bool DeveloperPrivateReloadFunction::RunImpl() { | 435 bool DeveloperPrivateReloadFunction::RunImpl() { |
413 std::string extension_id; | 436 std::string extension_id; |
414 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); | 437 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); |
415 ExtensionService* service = profile()->GetExtensionService(); | 438 ExtensionService* service = profile()->GetExtensionService(); |
416 CHECK(!extension_id.empty()); | 439 CHECK(!extension_id.empty()); |
417 service->ReloadExtension(extension_id); | 440 service->ReloadExtension(extension_id); |
418 SetResult(Value::CreateBooleanValue(true)); | 441 SetResult(Value::CreateBooleanValue(true)); |
419 return true; | 442 return true; |
420 } | 443 } |
421 | 444 |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
804 | 827 |
805 #undef SET_STRING | 828 #undef SET_STRING |
806 return true; | 829 return true; |
807 } | 830 } |
808 | 831 |
809 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} | 832 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} |
810 | 833 |
811 } // namespace api | 834 } // namespace api |
812 | 835 |
813 } // namespace extensions | 836 } // namespace extensions |
OLD | NEW |