| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_VERIFY_TRUST_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_VERIFY_TRUST_API_H_ | 
| 6 #define CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_VERIFY_TRUST_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_VERIFY_TRUST_API_H_ | 
| 7 | 7 | 
|  | 8 #include <memory> | 
| 8 #include <string> | 9 #include <string> | 
| 9 | 10 | 
| 10 #include "base/callback.h" | 11 #include "base/callback.h" | 
| 11 #include "base/macros.h" | 12 #include "base/macros.h" | 
| 12 #include "base/memory/scoped_ptr.h" |  | 
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" | 
| 14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" | 
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" | 
| 16 #include "extensions/browser/browser_context_keyed_api_factory.h" | 16 #include "extensions/browser/browser_context_keyed_api_factory.h" | 
| 17 #include "extensions/browser/extension_registry.h" | 17 #include "extensions/browser/extension_registry.h" | 
| 18 #include "extensions/browser/extension_registry_observer.h" | 18 #include "extensions/browser/extension_registry_observer.h" | 
| 19 | 19 | 
| 20 namespace content { | 20 namespace content { | 
| 21 class BrowserContext; | 21 class BrowserContext; | 
| 22 }  // namespace content | 22 }  // namespace content | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 50   explicit VerifyTrustAPI(content::BrowserContext* context); | 50   explicit VerifyTrustAPI(content::BrowserContext* context); | 
| 51   ~VerifyTrustAPI() override; | 51   ~VerifyTrustAPI() override; | 
| 52 | 52 | 
| 53   // Verifies the server certificate as described by |params| for the | 53   // Verifies the server certificate as described by |params| for the | 
| 54   // extension with id |extension_id|. When verification is complete | 54   // extension with id |extension_id|. When verification is complete | 
| 55   // (successful or not), the result will be passed to |callback|. | 55   // (successful or not), the result will be passed to |callback|. | 
| 56   // | 56   // | 
| 57   // Note: It is safe to delete this object while there are still | 57   // Note: It is safe to delete this object while there are still | 
| 58   // outstanding operations. However, if this happens, |callback| | 58   // outstanding operations. However, if this happens, |callback| | 
| 59   // will NOT be called. | 59   // will NOT be called. | 
| 60   void Verify(scoped_ptr<Params> params, | 60   void Verify(std::unique_ptr<Params> params, | 
| 61               const std::string& extension_id, | 61               const std::string& extension_id, | 
| 62               const VerifyCallback& callback); | 62               const VerifyCallback& callback); | 
| 63 | 63 | 
| 64   // ExtensionRegistryObserver: | 64   // ExtensionRegistryObserver: | 
| 65   void OnExtensionUnloaded(content::BrowserContext* browser_context, | 65   void OnExtensionUnloaded(content::BrowserContext* browser_context, | 
| 66                            const Extension* extension, | 66                            const Extension* extension, | 
| 67                            UnloadedExtensionInfo::Reason reason) override; | 67                            UnloadedExtensionInfo::Reason reason) override; | 
| 68 | 68 | 
| 69   // BrowserContextKeyedAPI: | 69   // BrowserContextKeyedAPI: | 
| 70   static BrowserContextKeyedAPIFactory<VerifyTrustAPI>* GetFactoryInstance(); | 70   static BrowserContextKeyedAPIFactory<VerifyTrustAPI>* GetFactoryInstance(); | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 88   static void CallBackOnUI(const VerifyCallback& ui_callback, | 88   static void CallBackOnUI(const VerifyCallback& ui_callback, | 
| 89                            const std::string& error, | 89                            const std::string& error, | 
| 90                            int return_value, | 90                            int return_value, | 
| 91                            int cert_status); | 91                            int cert_status); | 
| 92 | 92 | 
| 93   // BrowserContextKeyedAPI implementation. | 93   // BrowserContextKeyedAPI implementation. | 
| 94   static const char* service_name() { return "VerifyTrustAPI"; } | 94   static const char* service_name() { return "VerifyTrustAPI"; } | 
| 95 | 95 | 
| 96   // Created on the UIThread but must be used and destroyed only on the | 96   // Created on the UIThread but must be used and destroyed only on the | 
| 97   // IOThread. | 97   // IOThread. | 
| 98   scoped_ptr<IOPart, content::BrowserThread::DeleteOnIOThread> io_part_; | 98   std::unique_ptr<IOPart, content::BrowserThread::DeleteOnIOThread> io_part_; | 
| 99 | 99 | 
| 100   ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 100   ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 
| 101       registry_observer_; | 101       registry_observer_; | 
| 102 | 102 | 
| 103   base::WeakPtrFactory<VerifyTrustAPI> weak_factory_; | 103   base::WeakPtrFactory<VerifyTrustAPI> weak_factory_; | 
| 104 | 104 | 
| 105   DISALLOW_COPY_AND_ASSIGN(VerifyTrustAPI); | 105   DISALLOW_COPY_AND_ASSIGN(VerifyTrustAPI); | 
| 106 }; | 106 }; | 
| 107 | 107 | 
| 108 template <> | 108 template <> | 
| 109 void BrowserContextKeyedAPIFactory< | 109 void BrowserContextKeyedAPIFactory< | 
| 110     VerifyTrustAPI>::DeclareFactoryDependencies(); | 110     VerifyTrustAPI>::DeclareFactoryDependencies(); | 
| 111 | 111 | 
| 112 }  // namespace extensions | 112 }  // namespace extensions | 
| 113 | 113 | 
| 114 #endif  // CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_VERIFY_TRUST_API_H_ | 114 #endif  // CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_VERIFY_TRUST_API_H_ | 
| OLD | NEW | 
|---|