| 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/webstore_private/webstore_private_api.h" | 5 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/extensions/crx_installer.h" | 15 #include "chrome/browser/extensions/crx_installer.h" |
| 16 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 16 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 17 #include "chrome/browser/extensions/extension_prefs.h" | 17 #include "chrome/browser/extensions/extension_prefs.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/extensions/extension_system.h" |
| 19 #include "chrome/browser/extensions/webstore_installer.h" | 20 #include "chrome/browser/extensions/webstore_installer.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/browser/signin/token_service.h" | 23 #include "chrome/browser/signin/token_service.h" |
| 23 #include "chrome/browser/signin/token_service_factory.h" | 24 #include "chrome/browser/signin/token_service_factory.h" |
| 24 #include "chrome/browser/sync/profile_sync_service.h" | 25 #include "chrome/browser/sync/profile_sync_service.h" |
| 25 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 26 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
| 27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/extensions/extension_constants.h" | 29 #include "chrome/common/extensions/extension_constants.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 Release(); | 466 Release(); |
| 466 } | 467 } |
| 467 | 468 |
| 468 | 469 |
| 469 bool GetBrowserLoginFunction::RunImpl() { | 470 bool GetBrowserLoginFunction::RunImpl() { |
| 470 SetResult(CreateLoginResult(profile_->GetOriginalProfile())); | 471 SetResult(CreateLoginResult(profile_->GetOriginalProfile())); |
| 471 return true; | 472 return true; |
| 472 } | 473 } |
| 473 | 474 |
| 474 bool GetStoreLoginFunction::RunImpl() { | 475 bool GetStoreLoginFunction::RunImpl() { |
| 475 ExtensionService* service = profile_->GetExtensionService(); | 476 ExtensionService* service = |
| 477 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 476 ExtensionPrefs* prefs = service->extension_prefs(); | 478 ExtensionPrefs* prefs = service->extension_prefs(); |
| 477 std::string login; | 479 std::string login; |
| 478 if (prefs->GetWebStoreLogin(&login)) { | 480 if (prefs->GetWebStoreLogin(&login)) { |
| 479 SetResult(Value::CreateStringValue(login)); | 481 SetResult(Value::CreateStringValue(login)); |
| 480 } else { | 482 } else { |
| 481 SetResult(Value::CreateStringValue(std::string())); | 483 SetResult(Value::CreateStringValue(std::string())); |
| 482 } | 484 } |
| 483 return true; | 485 return true; |
| 484 } | 486 } |
| 485 | 487 |
| 486 bool SetStoreLoginFunction::RunImpl() { | 488 bool SetStoreLoginFunction::RunImpl() { |
| 487 std::string login; | 489 std::string login; |
| 488 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &login)); | 490 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &login)); |
| 489 ExtensionService* service = profile_->GetExtensionService(); | 491 ExtensionService* service = |
| 492 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 490 ExtensionPrefs* prefs = service->extension_prefs(); | 493 ExtensionPrefs* prefs = service->extension_prefs(); |
| 491 prefs->SetWebStoreLogin(login); | 494 prefs->SetWebStoreLogin(login); |
| 492 return true; | 495 return true; |
| 493 } | 496 } |
| 494 | 497 |
| 495 GetWebGLStatusFunction::GetWebGLStatusFunction() { | 498 GetWebGLStatusFunction::GetWebGLStatusFunction() { |
| 496 feature_checker_ = new GPUFeatureChecker( | 499 feature_checker_ = new GPUFeatureChecker( |
| 497 content::GPU_FEATURE_TYPE_WEBGL, | 500 content::GPU_FEATURE_TYPE_WEBGL, |
| 498 base::Bind(&GetWebGLStatusFunction::OnFeatureCheck, | 501 base::Bind(&GetWebGLStatusFunction::OnFeatureCheck, |
| 499 base::Unretained(this))); | 502 base::Unretained(this))); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 510 feature_checker_->CheckGPUFeatureAvailability(); | 513 feature_checker_->CheckGPUFeatureAvailability(); |
| 511 return true; | 514 return true; |
| 512 } | 515 } |
| 513 | 516 |
| 514 void GetWebGLStatusFunction::OnFeatureCheck(bool feature_allowed) { | 517 void GetWebGLStatusFunction::OnFeatureCheck(bool feature_allowed) { |
| 515 CreateResult(feature_allowed); | 518 CreateResult(feature_allowed); |
| 516 SendResponse(true); | 519 SendResponse(true); |
| 517 } | 520 } |
| 518 | 521 |
| 519 } // namespace extensions | 522 } // namespace extensions |
| OLD | NEW |