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 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_ANDROID_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_ANDROID_H_ 7 8 #include "base/memory/scoped_ptr.h" 9 #include "content/common/content_export.h" 10 #include "ui/gfx/native_widget_types.h" 11 12 namespace gfx { 13 class GLShareGroup; 14 } 15 16 namespace gpu { 17 namespace gles2 { 18 class GLES2Interface; 19 } 20 } 21 22 namespace content { 23 class GLHelper; 24 class GLContextLostListener; 25 26 class ImageTransportFactoryAndroidObserver { 27 public: 28 virtual ~ImageTransportFactoryAndroidObserver() {} 29 virtual void OnLostResources() = 0; 30 }; 31 32 class CONTENT_EXPORT ImageTransportFactoryAndroid { 33 public: 34 virtual ~ImageTransportFactoryAndroid(); 35 36 // Initializes the global transport factory for unit tests. 37 static void InitializeForUnitTests( 38 scoped_ptr<ImageTransportFactoryAndroid> test_factory); 39 // Terminates the global transport factory for unit tests. 40 static void TerminateForUnitTests(); 41 42 static ImageTransportFactoryAndroid* GetInstance(); 43 44 virtual GLHelper* GetGLHelper() = 0; 45 virtual uint32 GetChannelID() = 0; 46 47 static void AddObserver(ImageTransportFactoryAndroidObserver* observer); 48 static void RemoveObserver(ImageTransportFactoryAndroidObserver* observer); 49 50 protected: 51 ImageTransportFactoryAndroid(); 52 53 scoped_ptr<GLContextLostListener> context_lost_listener_; 54 }; 55 56 } // namespace content 57 58 #endif // CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_ANDROID_H_ 59