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

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

Issue 601293002: Chromecast: call ClosePage(), wait 50ms before deleting WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ 5 #ifndef CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
6 #define CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ 6 #define CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_contents_delegate.h" 21 #include "content/public/browser/web_contents_delegate.h"
21 #include "content/public/browser/web_contents_observer.h" 22 #include "content/public/browser/web_contents_observer.h"
22 #include "content/public/common/content_switches.h" 23 #include "content/public/common/content_switches.h"
23 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/size.h" 25 #include "ui/gfx/size.h"
25 26
26 class GURL; 27 class GURL;
27 28
(...skipping 10 matching lines...) Expand all
38 public content::WebContentsObserver { 39 public content::WebContentsObserver {
39 public: 40 public:
40 // Creates a new window and immediately loads the given URL. 41 // Creates a new window and immediately loads the given URL.
41 static CastWindowAndroid* CreateNewWindow( 42 static CastWindowAndroid* CreateNewWindow(
42 content::BrowserContext* browser_context, 43 content::BrowserContext* browser_context,
43 const GURL& url); 44 const GURL& url);
44 45
45 virtual ~CastWindowAndroid(); 46 virtual ~CastWindowAndroid();
46 47
47 void LoadURL(const GURL& url); 48 void LoadURL(const GURL& url);
49 // Gives a time interval to deliver window.unload event before window close.
lcwu1 2014/09/25 19:10:54 I think the comment should be something like "this
gunsch 2014/09/25 19:18:15 Done.
48 void Close(); 50 void Close();
51 // Destroys this window immediately.
52 void Destroy();
49 53
50 // Registers the JNI methods for CastWindowAndroid. 54 // Registers the JNI methods for CastWindowAndroid.
51 static bool RegisterJni(JNIEnv* env); 55 static bool RegisterJni(JNIEnv* env);
52 56
53 // content::WebContentsDelegate implementation: 57 // content::WebContentsDelegate implementation:
54 virtual void AddNewContents(content::WebContents* source, 58 virtual void AddNewContents(content::WebContents* source,
55 content::WebContents* new_contents, 59 content::WebContents* new_contents,
56 WindowOpenDisposition disposition, 60 WindowOpenDisposition disposition,
57 const gfx::Rect& initial_pos, 61 const gfx::Rect& initial_pos,
58 bool user_gesture, 62 bool user_gesture,
(...skipping 15 matching lines...) Expand all
74 explicit CastWindowAndroid(content::WebContents* web_contents); 78 explicit CastWindowAndroid(content::WebContents* web_contents);
75 79
76 // Helper to create a new CastWindowAndroid given a newly created WebContents. 80 // Helper to create a new CastWindowAndroid given a newly created WebContents.
77 static CastWindowAndroid* CreateCastWindowAndroid( 81 static CastWindowAndroid* CreateCastWindowAndroid(
78 content::WebContents* web_contents, 82 content::WebContents* web_contents,
79 const gfx::Size& initial_size); 83 const gfx::Size& initial_size);
80 84
81 base::android::ScopedJavaGlobalRef<jobject> java_object_; 85 base::android::ScopedJavaGlobalRef<jobject> java_object_;
82 scoped_ptr<content::WebContents> web_contents_; 86 scoped_ptr<content::WebContents> web_contents_;
83 87
88 base::WeakPtrFactory<CastWindowAndroid> weak_factory_;
89
84 DISALLOW_COPY_AND_ASSIGN(CastWindowAndroid); 90 DISALLOW_COPY_AND_ASSIGN(CastWindowAndroid);
85 }; 91 };
86 92
87 } // namespace shell 93 } // namespace shell
88 } // namespace chromecast 94 } // namespace chromecast
89 95
90 #endif // CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ 96 #endif // CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698