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

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

Issue 490603002: Chromecast: initial checkin of Android-based cast shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added android DEPS (git cl presubmit doesn't check Java DEPS?) Created 6 years, 3 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_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
6 #define CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
7
8 #include <jni.h>
9 #include <vector>
10
11 #include "base/android/jni_string.h"
12 #include "base/android/scoped_java_ref.h"
13 #include "base/basictypes.h"
14 #include "base/callback_forward.h"
15 #include "base/command_line.h"
16 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "build/build_config.h"
19 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_contents_delegate.h"
21 #include "content/public/browser/web_contents_observer.h"
22 #include "content/public/common/content_switches.h"
23 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/size.h"
25
26 class GURL;
27
28 namespace content {
29 class BrowserContext;
30 class SiteInstance;
31 class WebContents;
32 } // namespace content
33
34 namespace chromecast {
35 namespace shell {
36
37 class CastWindowAndroid : public content::WebContentsDelegate,
38 public content::WebContentsObserver {
39 public:
40 // Creates a new window and immediately loads the given URL.
41 static CastWindowAndroid* CreateNewWindow(
42 content::BrowserContext* browser_context,
43 const GURL& url);
44
45 virtual ~CastWindowAndroid();
46
47 void LoadURL(const GURL& url);
48 void Close();
49
50 // Registers the JNI methods for CastWindowAndroid.
51 static bool RegisterJni(JNIEnv* env);
52
53 // WebContentsDelegate implementation.
54 virtual void AddNewContents(content::WebContents* source,
55 content::WebContents* new_contents,
56 WindowOpenDisposition disposition,
57 const gfx::Rect& initial_pos,
58 bool user_gesture,
59 bool* was_blocked) OVERRIDE;
60 virtual void CloseContents(content::WebContents* source) OVERRIDE;
61 virtual bool CanOverscrollContent() const OVERRIDE;
62 virtual bool AddMessageToConsole(content::WebContents* source,
63 int32 level,
64 const base::string16& message,
65 int32 line_no,
66 const base::string16& source_id) OVERRIDE;
67 virtual void ActivateContents(content::WebContents* contents) OVERRIDE;
68 virtual void DeactivateContents(content::WebContents* contents) OVERRIDE;
69
70 private:
71 explicit CastWindowAndroid(content::WebContents* web_contents);
72
73 // Helper to create a new CastWindowAndroid given a newly created WebContents.
74 static CastWindowAndroid* CreateCastWindowAndroid(
75 content::WebContents* web_contents,
76 const gfx::Size& initial_size);
77
78 base::android::ScopedJavaGlobalRef<jobject> java_object_;
79 scoped_ptr<content::WebContents> web_contents_;
80
81 DISALLOW_COPY_AND_ASSIGN(CastWindowAndroid);
82 };
83
84 } // namespace shell
85 } // namespace chromecast
86
87 #endif // CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
OLDNEW
« no previous file with comments | « chromecast/shell/app/cast_main_delegate.cc ('k') | chromecast/shell/browser/android/cast_window_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698