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

Side by Side Diff: chrome/browser/extensions/extensions_service.cc

Issue 567037: Initial work on making extensions work in incognito mode. (Closed)
Patch Set: added experimental requirement Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extensions_service.h" 5 #include "chrome/browser/extensions/extensions_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 522
523 void ExtensionsService::SetLastPingDay(const std::string& extension_id, 523 void ExtensionsService::SetLastPingDay(const std::string& extension_id,
524 const base::Time& time) { 524 const base::Time& time) {
525 extension_prefs_->SetLastPingDay(extension_id, time); 525 extension_prefs_->SetLastPingDay(extension_id, time);
526 } 526 }
527 527
528 base::Time ExtensionsService::LastPingDay(const std::string& extension_id) { 528 base::Time ExtensionsService::LastPingDay(const std::string& extension_id) {
529 return extension_prefs_->LastPingDay(extension_id); 529 return extension_prefs_->LastPingDay(extension_id);
530 } 530 }
531 531
532 bool ExtensionsService::IsIncognitoEnabled(const std::string& extension_id) {
533 Extension* extension = GetExtensionById(extension_id, true);
534 if (!extension)
535 return false;
536
537 return extension_prefs_->IsIncognitoEnabled(extension_id) &&
538 extension->HasApiPermission(Extension::kExperimentalPermission) &&
539 extension->HasApiPermission(Extension::kIncognitoPermission);
540 }
541
532 void ExtensionsService::CheckForExternalUpdates() { 542 void ExtensionsService::CheckForExternalUpdates() {
533 // This installs or updates externally provided extensions. 543 // This installs or updates externally provided extensions.
534 // TODO(aa): Why pass this list into the provider, why not just filter it 544 // TODO(aa): Why pass this list into the provider, why not just filter it
535 // later? 545 // later?
536 std::set<std::string> killed_extensions; 546 std::set<std::string> killed_extensions;
537 extension_prefs_->GetKilledExtensionIds(&killed_extensions); 547 extension_prefs_->GetKilledExtensionIds(&killed_extensions);
538 ChromeThread::PostTask( 548 ChromeThread::PostTask(
539 ChromeThread::FILE, FROM_HERE, 549 ChromeThread::FILE, FROM_HERE,
540 NewRunnableMethod( 550 NewRunnableMethod(
541 backend_.get(), &ExtensionsServiceBackend::CheckForExternalUpdates, 551 backend_.get(), &ExtensionsServiceBackend::CheckForExternalUpdates,
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 // Finish installing on UI thread. 1086 // Finish installing on UI thread.
1077 ChromeThread::PostTask( 1087 ChromeThread::PostTask(
1078 ChromeThread::UI, FROM_HERE, 1088 ChromeThread::UI, FROM_HERE,
1079 NewRunnableMethod( 1089 NewRunnableMethod(
1080 frontend_, 1090 frontend_,
1081 &ExtensionsService::ContinueLoadAllExtensions, 1091 &ExtensionsService::ContinueLoadAllExtensions,
1082 extensions_to_reload, 1092 extensions_to_reload,
1083 start_time, 1093 start_time,
1084 true)); 1094 true));
1085 } 1095 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.h ('k') | chrome/browser/extensions/incognito_noscript_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698