Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: ui/android/resources/resource_manager_impl.h

Issue 1419843002: Hold a reference to any kind of context in WindowAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove keyword explicit from TestResourceManagerImpl ctor. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_IMPL_H_ 5 #ifndef UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_
6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ 6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_
7 7
8 #include "base/id_map.h" 8 #include "base/id_map.h"
9 #include "ui/android/resources/resource_manager.h" 9 #include "ui/android/resources/resource_manager.h"
10 #include "ui/android/ui_android_export.h" 10 #include "ui/android/ui_android_export.h"
11 #include "ui/gfx/geometry/rect.h" 11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/native_widget_types.h"
12 13
13 namespace ui { 14 namespace ui {
14 15
15 class UI_ANDROID_EXPORT ResourceManagerImpl : public ResourceManager { 16 class UI_ANDROID_EXPORT ResourceManagerImpl : public ResourceManager {
16 public: 17 public:
17 static ResourceManagerImpl* FromJavaObject(jobject jobj); 18 static ResourceManagerImpl* FromJavaObject(jobject jobj);
18 19
19 ResourceManagerImpl(); 20 explicit ResourceManagerImpl(gfx::NativeWindow native_window);
20 ~ResourceManagerImpl() override; 21 ~ResourceManagerImpl() override;
21 22
22 void Init(cc::LayerTreeHost* host); 23 void Init(cc::LayerTreeHost* host);
23 24
24 // ResourceManager implementation. 25 // ResourceManager implementation.
25 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; 26 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override;
26 Resource* GetResource(AndroidResourceType res_type, int res_id) override; 27 Resource* GetResource(AndroidResourceType res_type, int res_id) override;
27 void PreloadResource(AndroidResourceType res_type, int res_id) override; 28 void PreloadResource(AndroidResourceType res_type, int res_id) override;
28 29
29 // Called from Java 30 // Called from Java
(...skipping 10 matching lines...) Expand all
40 jint aperture_left, 41 jint aperture_left,
41 jint aperture_top, 42 jint aperture_top,
42 jint aperture_right, 43 jint aperture_right,
43 jint aperture_bottom); 44 jint aperture_bottom);
44 45
45 static bool RegisterResourceManager(JNIEnv* env); 46 static bool RegisterResourceManager(JNIEnv* env);
46 47
47 private: 48 private:
48 friend class TestResourceManagerImpl; 49 friend class TestResourceManagerImpl;
49 50
51 // Only for testing
52 explicit ResourceManagerImpl(jobject Context);
jdduke (slow) 2015/10/23 16:47:27 Nit: lowercase context
gsennton 2015/10/26 16:22:35 Done.
53
50 // Start loading the resource. virtual for testing. 54 // Start loading the resource. virtual for testing.
51 virtual void PreloadResourceFromJava(AndroidResourceType res_type, 55 virtual void PreloadResourceFromJava(AndroidResourceType res_type,
52 int res_id); 56 int res_id);
53 virtual void RequestResourceFromJava(AndroidResourceType res_type, 57 virtual void RequestResourceFromJava(AndroidResourceType res_type,
54 int res_id); 58 int res_id);
55 59
56 typedef IDMap<Resource, IDMapOwnPointer> ResourceMap; 60 typedef IDMap<Resource, IDMapOwnPointer> ResourceMap;
57 61
58 cc::LayerTreeHost* host_; 62 cc::LayerTreeHost* host_;
59 ResourceMap resources_[ANDROID_RESOURCE_TYPE_COUNT]; 63 ResourceMap resources_[ANDROID_RESOURCE_TYPE_COUNT];
60 64
61 base::android::ScopedJavaGlobalRef<jobject> java_obj_; 65 base::android::ScopedJavaGlobalRef<jobject> java_obj_;
62 66
63 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); 67 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl);
64 }; 68 };
65 69
66 } // namespace ui 70 } // namespace ui
67 71
68 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ 72 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698