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 CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ | 5 #ifndef CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ |
6 #define CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ | 6 #define CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 namespace shell { | 37 namespace shell { |
38 | 38 |
39 class CastWindowAndroid : public content::WebContentsDelegate, | 39 class CastWindowAndroid : public content::WebContentsDelegate, |
40 public content::WebContentsObserver { | 40 public content::WebContentsObserver { |
41 public: | 41 public: |
42 // Creates a new window and immediately loads the given URL. | 42 // Creates a new window and immediately loads the given URL. |
43 static CastWindowAndroid* CreateNewWindow( | 43 static CastWindowAndroid* CreateNewWindow( |
44 content::BrowserContext* browser_context, | 44 content::BrowserContext* browser_context, |
45 const GURL& url); | 45 const GURL& url); |
46 | 46 |
47 virtual ~CastWindowAndroid(); | 47 ~CastWindowAndroid() override; |
48 | 48 |
49 void LoadURL(const GURL& url); | 49 void LoadURL(const GURL& url); |
50 // Calls RVH::ClosePage() and waits for acknowledgement before closing/ | 50 // Calls RVH::ClosePage() and waits for acknowledgement before closing/ |
51 // deleting the window. | 51 // deleting the window. |
52 void Close(); | 52 void Close(); |
53 // Destroys this window immediately. | 53 // Destroys this window immediately. |
54 void Destroy(); | 54 void Destroy(); |
55 | 55 |
56 // Registers the JNI methods for CastWindowAndroid. | 56 // Registers the JNI methods for CastWindowAndroid. |
57 static bool RegisterJni(JNIEnv* env); | 57 static bool RegisterJni(JNIEnv* env); |
58 | 58 |
59 // content::WebContentsDelegate implementation: | 59 // content::WebContentsDelegate implementation: |
60 virtual void AddNewContents(content::WebContents* source, | 60 void AddNewContents(content::WebContents* source, |
61 content::WebContents* new_contents, | 61 content::WebContents* new_contents, |
62 WindowOpenDisposition disposition, | 62 WindowOpenDisposition disposition, |
63 const gfx::Rect& initial_rect, | 63 const gfx::Rect& initial_rect, |
64 bool user_gesture, | 64 bool user_gesture, |
65 bool* was_blocked) override; | 65 bool* was_blocked) override; |
66 virtual void CloseContents(content::WebContents* source) override; | 66 void CloseContents(content::WebContents* source) override; |
67 virtual bool CanOverscrollContent() const override; | 67 bool CanOverscrollContent() const override; |
68 virtual bool AddMessageToConsole(content::WebContents* source, | 68 bool AddMessageToConsole(content::WebContents* source, |
69 int32 level, | 69 int32 level, |
70 const base::string16& message, | 70 const base::string16& message, |
71 int32 line_no, | 71 int32 line_no, |
72 const base::string16& source_id) override; | 72 const base::string16& source_id) override; |
73 virtual void ActivateContents(content::WebContents* contents) override; | 73 void ActivateContents(content::WebContents* contents) override; |
74 virtual void DeactivateContents(content::WebContents* contents) override; | 74 void DeactivateContents(content::WebContents* contents) override; |
75 | 75 |
76 // content::WebContentsObserver implementation: | 76 // content::WebContentsObserver implementation: |
77 virtual void RenderProcessGone(base::TerminationStatus status) override; | 77 void RenderProcessGone(base::TerminationStatus status) override; |
78 | 78 |
79 private: | 79 private: |
80 explicit CastWindowAndroid(content::BrowserContext* browser_context); | 80 explicit CastWindowAndroid(content::BrowserContext* browser_context); |
81 void Initialize(); | 81 void Initialize(); |
82 | 82 |
83 content::BrowserContext* browser_context_; | 83 content::BrowserContext* browser_context_; |
84 base::android::ScopedJavaGlobalRef<jobject> window_java_; | 84 base::android::ScopedJavaGlobalRef<jobject> window_java_; |
85 scoped_ptr<content::WebContents> web_contents_; | 85 scoped_ptr<content::WebContents> web_contents_; |
86 scoped_ptr<CastContentWindow> content_window_; | 86 scoped_ptr<CastContentWindow> content_window_; |
87 | 87 |
88 base::WeakPtrFactory<CastWindowAndroid> weak_factory_; | 88 base::WeakPtrFactory<CastWindowAndroid> weak_factory_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(CastWindowAndroid); | 90 DISALLOW_COPY_AND_ASSIGN(CastWindowAndroid); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace shell | 93 } // namespace shell |
94 } // namespace chromecast | 94 } // namespace chromecast |
95 | 95 |
96 #endif // CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ | 96 #endif // CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ |
OLD | NEW |