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

Side by Side Diff: content/browser/android/content_video_view.h

Issue 2353063005: Refactor ContentViewClient (1/6) (Closed)
Patch Set: fix tests Created 4 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 (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 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_
6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/jni_weak_ref.h" 10 #include "base/android/jni_weak_ref.h"
11 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "content/public/browser/android/content_view_core.h" 14 #include "content/public/browser/android/content_view_core.h"
15 #include "ui/gl/android/scoped_java_surface.h" 15 #include "ui/gl/android/scoped_java_surface.h"
16 16
17 namespace web_contents_delegate_android {
boliu 2016/09/26 21:25:24 this is unused (also layering violation?)
Jinsuk Kim 2016/09/27 10:08:58 Done.
18 class WebContentsDelegateAndroid;
19 }
20
17 namespace content { 21 namespace content {
18 22
19 // Native mirror of ContentVideoView.java. This class is responsible for 23 // Native mirror of ContentVideoView.java. This class is responsible for
20 // creating the Java video view and passing changes in player status to it. 24 // creating the Java video view and passing changes in player status to it.
21 // This class must be used on the UI thread. 25 // This class must be used on the UI thread.
22 class ContentVideoView { 26 class ContentVideoView {
23 public: 27 public:
24 static bool RegisterContentVideoView(JNIEnv* env); 28 static bool RegisterContentVideoView(JNIEnv* env);
25 29
26 // Returns the singleton object or NULL. 30 // Returns the singleton object or NULL.
(...skipping 12 matching lines...) Expand all
39 virtual void DidExitFullscreen(bool release_media_player) = 0; 43 virtual void DidExitFullscreen(bool release_media_player) = 0;
40 44
41 protected: 45 protected:
42 ~Client() {} 46 ~Client() {}
43 47
44 DISALLOW_COPY_AND_ASSIGN(Client); 48 DISALLOW_COPY_AND_ASSIGN(Client);
45 }; 49 };
46 50
47 explicit ContentVideoView(Client* client, 51 explicit ContentVideoView(Client* client,
48 ContentViewCore* content_view_core, 52 ContentViewCore* content_view_core,
53 const base::android::JavaRef<jobject>& embedder,
49 const gfx::Size& video_natural_size); 54 const gfx::Size& video_natural_size);
50 ~ContentVideoView(); 55 ~ContentVideoView();
51 56
52 // To open another video on existing ContentVideoView. 57 // To open another video on existing ContentVideoView.
53 void OpenVideo(); 58 void OpenVideo();
54 59
55 // Display an error dialog to the user. 60 // Display an error dialog to the user.
56 void OnMediaPlayerError(int error_type); 61 void OnMediaPlayerError(int error_type);
57 62
58 // Update the video size. 63 // Update the video size.
(...skipping 24 matching lines...) Expand all
83 bool is_orientation_portrait); 88 bool is_orientation_portrait);
84 void RecordExitFullscreenPlayback( 89 void RecordExitFullscreenPlayback(
85 JNIEnv*, 90 JNIEnv*,
86 const base::android::JavaParamRef<jobject>&, 91 const base::android::JavaParamRef<jobject>&,
87 bool is_portrait_video, 92 bool is_portrait_video,
88 long playback_duration_in_milliseconds_before_orientation_change, 93 long playback_duration_in_milliseconds_before_orientation_change,
89 long playback_duration_in_milliseconds_after_orientation_change); 94 long playback_duration_in_milliseconds_after_orientation_change);
90 95
91 private: 96 private:
92 // Creates the corresponding ContentVideoView Java object. 97 // Creates the corresponding ContentVideoView Java object.
93 JavaObjectWeakGlobalRef CreateJavaObject(ContentViewCore* content_view_core, 98 JavaObjectWeakGlobalRef CreateJavaObject(
94 const gfx::Size& video_natural_size); 99 ContentViewCore* content_view_core,
100 const base::android::JavaRef<jobject>& j_content_video_view_embedder,
101 const gfx::Size& video_natural_size);
95 102
96 Client* client_; 103 Client* client_;
97 104
98 // Weak reference to corresponding Java object. 105 // Weak reference to corresponding Java object.
99 JavaObjectWeakGlobalRef j_content_video_view_; 106 JavaObjectWeakGlobalRef j_content_video_view_;
100 107
101 // Weak pointer for posting tasks. 108 // Weak pointer for posting tasks.
102 base::WeakPtrFactory<ContentVideoView> weak_factory_; 109 base::WeakPtrFactory<ContentVideoView> weak_factory_;
103 110
104 DISALLOW_COPY_AND_ASSIGN(ContentVideoView); 111 DISALLOW_COPY_AND_ASSIGN(ContentVideoView);
105 }; 112 };
106 113
107 } // namespace content 114 } // namespace content
108 115
109 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ 116 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698