Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: chrome/browser/extensions/api/developer_private/developer_private_api.cc

Issue 12317036: Add API in developerPrivate to allow/ disallow incognito mode. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 SetResult(Value::CreateBooleanValue(result));
asargent_no_longer_on_chrome 2013/02/22 00:04:06 nit: instead of a boolean result passed as an argu
Gaurav 2013/02/25 18:26:51 Done.
429 return true;
430 }
431
432 DeveloperPrivateAllowIncognitoFunction::
433 ~DeveloperPrivateAllowIncognitoFunction() {}
434
435
412 bool DeveloperPrivateReloadFunction::RunImpl() { 436 bool DeveloperPrivateReloadFunction::RunImpl() {
413 std::string extension_id; 437 std::string extension_id;
414 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); 438 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id));
415 ExtensionService* service = profile()->GetExtensionService(); 439 ExtensionService* service = profile()->GetExtensionService();
416 CHECK(!extension_id.empty()); 440 CHECK(!extension_id.empty());
417 service->ReloadExtension(extension_id); 441 service->ReloadExtension(extension_id);
418 SetResult(Value::CreateBooleanValue(true)); 442 SetResult(Value::CreateBooleanValue(true));
419 return true; 443 return true;
420 } 444 }
421 445
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 828
805 #undef SET_STRING 829 #undef SET_STRING
806 return true; 830 return true;
807 } 831 }
808 832
809 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} 833 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {}
810 834
811 } // namespace api 835 } // namespace api
812 836
813 } // namespace extensions 837 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698