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

Side by Side Diff: chromecast/browser/android/cast_window_android.h

Issue 2570623003: [Chromecast] Turn CastContentWindow into an abstract interface. (Closed)
Patch Set: Fix browser test Created 3 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
6 #define CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
7
8 #include <jni.h>
9 #include <stdint.h>
10
11 #include <memory>
12 #include <vector>
13
14 #include "base/android/jni_string.h"
15 #include "base/android/scoped_java_ref.h"
16 #include "base/callback_forward.h"
17 #include "base/command_line.h"
18 #include "base/macros.h"
19 #include "base/memory/weak_ptr.h"
20 #include "build/build_config.h"
21 #include "content/public/browser/web_contents.h"
22 #include "content/public/browser/web_contents_delegate.h"
23 #include "content/public/browser/web_contents_observer.h"
24 #include "content/public/common/content_switches.h"
25 #include "ui/gfx/geometry/size.h"
26 #include "ui/gfx/native_widget_types.h"
27
28 class GURL;
29
30 namespace content {
31 class BrowserContext;
32 class WebContents;
33 } // namespace content
34
35 namespace chromecast {
36 namespace shell {
37 class CastContentWindow;
38
39 class CastWindowAndroid : public content::WebContentsDelegate,
40 public content::WebContentsObserver {
41 public:
42 // Creates a new window and immediately loads the given URL.
43 static CastWindowAndroid* CreateNewWindow(
44 content::BrowserContext* browser_context,
45 const GURL& url);
46
47 ~CastWindowAndroid() override;
48
49 void LoadURL(const GURL& url);
50 // Calls RVH::ClosePage() and waits for acknowledgement before closing/
51 // deleting the window.
52 void Close();
53 // Destroys this window immediately.
54 void Destroy();
55
56 // content::WebContentsDelegate implementation:
57 void AddNewContents(content::WebContents* source,
58 content::WebContents* new_contents,
59 WindowOpenDisposition disposition,
60 const gfx::Rect& initial_rect,
61 bool user_gesture,
62 bool* was_blocked) override;
63 void CloseContents(content::WebContents* source) override;
64 bool CanOverscrollContent() const override;
65 bool DidAddMessageToConsole(content::WebContents* source,
66 int32_t level,
67 const base::string16& message,
68 int32_t line_no,
69 const base::string16& source_id) override;
70 void ActivateContents(content::WebContents* contents) override;
71 base::android::ScopedJavaLocalRef<jobject>
72 GetContentVideoViewEmbedder() override;
73
74 // content::WebContentsObserver implementation:
75 void RenderProcessGone(base::TerminationStatus status) override;
76
77 private:
78 explicit CastWindowAndroid(content::BrowserContext* browser_context);
79 void Initialize();
80
81 content::BrowserContext* browser_context_;
82 base::android::ScopedJavaGlobalRef<jobject> window_java_;
83 std::unique_ptr<content::WebContents> web_contents_;
84 std::unique_ptr<CastContentWindow> content_window_;
85
86 base::WeakPtrFactory<CastWindowAndroid> weak_factory_;
87
88 DISALLOW_COPY_AND_ASSIGN(CastWindowAndroid);
89 };
90
91 } // namespace shell
92 } // namespace chromecast
93
94 #endif // CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
OLDNEW
« no previous file with comments | « chromecast/browser/android/cast_web_contents_activity.cc ('k') | chromecast/browser/android/cast_window_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698