| 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/extension_webstore_private_api.h" | 5 #include "chrome/browser/extensions/extension_webstore_private_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/extensions/crx_installer.h" | 13 #include "chrome/browser/extensions/crx_installer.h" |
| 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 15 #include "chrome/browser/extensions/extension_install_dialog.h" | 15 #include "chrome/browser/extensions/extension_install_dialog.h" |
| 16 #include "chrome/browser/extensions/extension_prefs.h" | 16 #include "chrome/browser/extensions/extension_prefs.h" |
| 17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/extensions/webstore_installer.h" | 18 #include "chrome/browser/extensions/webstore_installer.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/signin/token_service.h" | 20 #include "chrome/browser/signin/token_service.h" |
| 21 #include "chrome/browser/sync/profile_sync_service.h" | 21 #include "chrome/browser/sync/profile_sync_service.h" |
| 22 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 22 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
| 23 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/common/extensions/extension_constants.h" | 26 #include "chrome/common/extensions/extension_constants.h" |
| 26 #include "chrome/common/extensions/extension_error_utils.h" | 27 #include "chrome/common/extensions/extension_error_utils.h" |
| 27 #include "chrome/common/extensions/extension_l10n_util.h" | 28 #include "chrome/common/extensions/extension_l10n_util.h" |
| 28 #include "chrome/common/net/gaia/gaia_constants.h" | 29 #include "chrome/common/net/gaia/gaia_constants.h" |
| 29 #include "content/public/browser/notification_details.h" | 30 #include "content/public/browser/notification_details.h" |
| 30 #include "content/public/browser/notification_source.h" | 31 #include "content/public/browser/notification_source.h" |
| 31 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 const char kNoPreviousBeginInstallWithManifestError[] = | 53 const char kNoPreviousBeginInstallWithManifestError[] = |
| 53 "* does not match a previous call to beginInstallWithManifest3"; | 54 "* does not match a previous call to beginInstallWithManifest3"; |
| 54 const char kUserCancelledError[] = "User cancelled install"; | 55 const char kUserCancelledError[] = "User cancelled install"; |
| 55 const char kPermissionDeniedError[] = | 56 const char kPermissionDeniedError[] = |
| 56 "You do not have permission to use this method."; | 57 "You do not have permission to use this method."; |
| 57 | 58 |
| 58 ProfileSyncService* test_sync_service = NULL; | 59 ProfileSyncService* test_sync_service = NULL; |
| 59 | 60 |
| 60 // Returns either the test sync service, or the real one from |profile|. | 61 // Returns either the test sync service, or the real one from |profile|. |
| 61 ProfileSyncService* GetSyncService(Profile* profile) { | 62 ProfileSyncService* GetSyncService(Profile* profile) { |
| 63 // TODO(webstore): It seems |test_sync_service| is not used anywhere. It |
| 64 // should be removed. |
| 62 if (test_sync_service) | 65 if (test_sync_service) |
| 63 return test_sync_service; | 66 return test_sync_service; |
| 64 else | 67 else |
| 65 return profile->GetProfileSyncService(); | 68 return ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
| 66 } | 69 } |
| 67 | 70 |
| 68 bool IsWebStoreURL(Profile* profile, const GURL& url) { | 71 bool IsWebStoreURL(Profile* profile, const GURL& url) { |
| 69 ExtensionService* service = profile->GetExtensionService(); | 72 ExtensionService* service = profile->GetExtensionService(); |
| 70 const Extension* store = service->GetWebStoreApp(); | 73 const Extension* store = service->GetWebStoreApp(); |
| 71 if (!store) { | 74 if (!store) { |
| 72 NOTREACHED(); | 75 NOTREACHED(); |
| 73 return false; | 76 return false; |
| 74 } | 77 } |
| 75 return (service->extensions()->GetHostedAppByURL(ExtensionURLInfo(url)) == | 78 return (service->extensions()->GetHostedAppByURL(ExtensionURLInfo(url)) == |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 SendResponse(true); | 550 SendResponse(true); |
| 548 } else { | 551 } else { |
| 549 // Matched with a Release in OnGpuInfoUpdate. | 552 // Matched with a Release in OnGpuInfoUpdate. |
| 550 AddRef(); | 553 AddRef(); |
| 551 | 554 |
| 552 manager->AddObserver(this); | 555 manager->AddObserver(this); |
| 553 manager->RequestCompleteGpuInfoIfNeeded(); | 556 manager->RequestCompleteGpuInfoIfNeeded(); |
| 554 } | 557 } |
| 555 return true; | 558 return true; |
| 556 } | 559 } |
| 557 | |
| OLD | NEW |