OLD | NEW |
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_VIEW_CLIENT_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CLIENT_H_ |
6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CLIENT_H_ | 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CLIENT_H_ |
7 | 7 |
8 #include "base/android/jni_helper.h" | 8 #include "base/android/jni_helper.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "content/public/browser/native_web_keyboard_event.h" | 10 #include "content/public/browser/native_web_keyboard_event.h" |
11 #include "content/public/common/javascript_message_type.h" | |
12 #include "content/public/common/referrer.h" | 11 #include "content/public/common/referrer.h" |
13 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
14 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
15 | 14 |
16 namespace content { | 15 namespace content { |
17 | 16 |
18 class DownloadItem; | 17 class DownloadItem; |
19 class JavaScriptDialogCreator; | 18 class JavaScriptDialogCreator; |
20 struct NativeWebKeyboardEvent; | 19 struct NativeWebKeyboardEvent; |
21 class RenderViewHost; | 20 class RenderViewHost; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void OnLoadStarted(); | 76 void OnLoadStarted(); |
78 void OnLoadStopped(); | 77 void OnLoadStopped(); |
79 void OnReceivedError(int error_code, | 78 void OnReceivedError(int error_code, |
80 const string16& description, | 79 const string16& description, |
81 const GURL& url); | 80 const GURL& url); |
82 void OnDidCommitMainFrame(const GURL& url, | 81 void OnDidCommitMainFrame(const GURL& url, |
83 const GURL& base_url); | 82 const GURL& base_url); |
84 void OnInterstitialShown(); | 83 void OnInterstitialShown(); |
85 void OnInterstitialHidden(); | 84 void OnInterstitialHidden(); |
86 | 85 |
87 void SetJavaScriptDialogCreator( | |
88 JavaScriptDialogCreator* javascript_dialog_creator); | |
89 | |
90 bool OnJSModalDialog(JavaScriptMessageType type, | |
91 bool is_before_unload_dialog, | |
92 const GURL& url, | |
93 const string16& message, | |
94 const string16& default_value); | |
95 | |
96 private: | 86 private: |
97 // Get the closest ContentViewClient match to the given Chrome error code. | 87 // Get the closest ContentViewClient match to the given Chrome error code. |
98 static ContentViewClientError ToContentViewClientError(int net_error); | 88 static ContentViewClientError ToContentViewClientError(int net_error); |
99 | 89 |
100 // We depend on ContentView.java to hold a ref to the client object. If we | 90 // We depend on ContentView.java to hold a ref to the client object. If we |
101 // were to hold a hard ref from native we could end up with a cyclic | 91 // were to hold a hard ref from native we could end up with a cyclic |
102 // ownership leak (the GC can't collect cycles if part of the cycle is caused | 92 // ownership leak (the GC can't collect cycles if part of the cycle is caused |
103 // by native). | 93 // by native). |
104 JavaObjectWeakGlobalRef weak_java_client_; | 94 JavaObjectWeakGlobalRef weak_java_client_; |
105 }; | 95 }; |
106 | 96 |
107 bool RegisterContentViewClient(JNIEnv* env); | 97 bool RegisterContentViewClient(JNIEnv* env); |
108 | 98 |
109 } // namespace content | 99 } // namespace content |
110 | 100 |
111 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CLIENT_H_ | 101 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CLIENT_H_ |
OLD | NEW |