OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ | 5 #ifndef UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ |
6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ | 6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "cc/resources/scoped_ui_resource.h" | 11 #include "cc/resources/scoped_ui_resource.h" |
11 #include "ui/android/resources/crushed_sprite_resource.h" | 12 #include "ui/android/resources/crushed_sprite_resource.h" |
12 #include "ui/android/ui_android_export.h" | 13 #include "ui/android/ui_android_export.h" |
13 #include "ui/gfx/geometry/insets_f.h" | 14 #include "ui/gfx/geometry/insets_f.h" |
14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
15 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
16 | 17 |
17 namespace ui { | 18 namespace ui { |
18 | 19 |
19 class UIResourceProvider; | 20 class UIResourceProvider; |
(...skipping 16 matching lines...) Expand all Loading... |
36 // APIs and consumed by the compositor. | 37 // APIs and consumed by the compositor. |
37 class UI_ANDROID_EXPORT ResourceManager { | 38 class UI_ANDROID_EXPORT ResourceManager { |
38 public: | 39 public: |
39 struct Resource { | 40 struct Resource { |
40 public: | 41 public: |
41 Resource(); | 42 Resource(); |
42 ~Resource(); | 43 ~Resource(); |
43 gfx::Rect Border(const gfx::Size& bounds) const; | 44 gfx::Rect Border(const gfx::Size& bounds) const; |
44 gfx::Rect Border(const gfx::Size& bounds, const gfx::InsetsF& scale) const; | 45 gfx::Rect Border(const gfx::Size& bounds, const gfx::InsetsF& scale) const; |
45 | 46 |
46 scoped_ptr<cc::ScopedUIResource> ui_resource; | 47 std::unique_ptr<cc::ScopedUIResource> ui_resource; |
47 gfx::Size size; | 48 gfx::Size size; |
48 gfx::Rect padding; | 49 gfx::Rect padding; |
49 gfx::Rect aperture; | 50 gfx::Rect aperture; |
50 }; | 51 }; |
51 | 52 |
52 // Obtain a handle to the Java ResourceManager counterpart. | 53 // Obtain a handle to the Java ResourceManager counterpart. |
53 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; | 54 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; |
54 | 55 |
55 // Return a handle to the resource specified by |res_type| and |res_id|. | 56 // Return a handle to the resource specified by |res_type| and |res_id|. |
56 // If the resource has not been loaded, loading will be performed | 57 // If the resource has not been loaded, loading will be performed |
(...skipping 20 matching lines...) Expand all Loading... |
77 return resource && resource->ui_resource ? resource->ui_resource->id() : 0; | 78 return resource && resource->ui_resource ? resource->ui_resource->id() : 0; |
78 } | 79 } |
79 | 80 |
80 protected: | 81 protected: |
81 virtual ~ResourceManager() {} | 82 virtual ~ResourceManager() {} |
82 }; | 83 }; |
83 | 84 |
84 } // namespace ui | 85 } // namespace ui |
85 | 86 |
86 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ | 87 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ |
OLD | NEW |