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

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: rebase Created 7 years, 9 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 service->SetAllowFileAccess(extension, allow); 401 service->SetAllowFileAccess(extension, allow);
402 result = true; 402 result = true;
403 } 403 }
404 404
405 return result; 405 return result;
406 } 406 }
407 407
408 DeveloperPrivateAllowFileAccessFunction:: 408 DeveloperPrivateAllowFileAccessFunction::
409 ~DeveloperPrivateAllowFileAccessFunction() {} 409 ~DeveloperPrivateAllowFileAccessFunction() {}
410 410
411 bool DeveloperPrivateAllowIncognitoFunction::RunImpl() {
412 std::string extension_id;
413 bool allow = false;
414 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id));
415 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &allow));
416
417 ExtensionService* service = profile()->GetExtensionService();
418 const Extension* extension = service->GetInstalledExtension(extension_id);
419 bool result = true;
420
421 if (!extension) {
422 result = false;
423 } else {
424 service->SetIsIncognitoEnabled(extension->id(), allow);
425 }
426
427 return result;
428 }
429
430 DeveloperPrivateAllowIncognitoFunction::
431 ~DeveloperPrivateAllowIncognitoFunction() {}
432
433
411 bool DeveloperPrivateReloadFunction::RunImpl() { 434 bool DeveloperPrivateReloadFunction::RunImpl() {
412 std::string extension_id; 435 std::string extension_id;
413 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id)); 436 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id));
414 ExtensionService* service = profile()->GetExtensionService(); 437 ExtensionService* service = profile()->GetExtensionService();
415 CHECK(!extension_id.empty()); 438 CHECK(!extension_id.empty());
416 service->ReloadExtension(extension_id); 439 service->ReloadExtension(extension_id);
417 return true; 440 return true;
418 } 441 }
419 442
420 DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {} 443 DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {}
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 834
812 #undef SET_STRING 835 #undef SET_STRING
813 return true; 836 return true;
814 } 837 }
815 838
816 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} 839 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {}
817 840
818 } // namespace api 841 } // namespace api
819 842
820 } // namespace extensions 843 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698