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

Side by Side Diff: content/components/web_contents_delegate_android/web_contents_delegate_android.h

Issue 11365199: Move WebContentsDelegateAndroid to content/components (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELE GATE_ANDROID_H_ 5 #ifndef CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELE GATE_ANDROID_H_
6 #define CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELE GATE_ANDROID_H_ 6 #define CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELE GATE_ANDROID_H_
7 7
8 #include "base/android/jni_helper.h" 8 #include "base/android/jni_helper.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/native_web_keyboard_event.h" 12 #include "content/public/browser/native_web_keyboard_event.h"
13 #include "content/public/browser/web_contents_delegate.h" 13 #include "content/public/browser/web_contents_delegate.h"
14 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
15 #include "content/public/common/javascript_message_type.h" 15 #include "content/public/common/javascript_message_type.h"
16 #include "content/public/common/referrer.h" 16 #include "content/public/common/referrer.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
19 19
20 namespace content { 20 namespace content {
21 class JavaScriptDialogCreator; 21 class JavaScriptDialogCreator;
22 class RenderViewHost; 22 class RenderViewHost;
23 class WebContents; 23 class WebContents;
24 class WebContentsObserver; 24 class WebContentsObserver;
25 struct NativeWebKeyboardEvent; 25 struct NativeWebKeyboardEvent;
26 }
27
28 namespace web_contents_delegate_android {
29 26
30 enum WebContentsDelegateLogLevel { 27 enum WebContentsDelegateLogLevel {
31 // Equivalent of WebCore::WebConsoleMessage::LevelTip. 28 // Equivalent of WebCore::WebConsoleMessage::LevelTip.
32 WEB_CONTENTS_DELEGATE_LOG_LEVEL_TIP = 0, 29 WEB_CONTENTS_DELEGATE_LOG_LEVEL_TIP = 0,
33 // Equivalent of WebCore::WebConsoleMessage::LevelLog. 30 // Equivalent of WebCore::WebConsoleMessage::LevelLog.
34 WEB_CONTENTS_DELEGATE_LOG_LEVEL_LOG = 1, 31 WEB_CONTENTS_DELEGATE_LOG_LEVEL_LOG = 1,
35 // Equivalent of WebCore::WebConsoleMessage::LevelWarning. 32 // Equivalent of WebCore::WebConsoleMessage::LevelWarning.
36 WEB_CONTENTS_DELEGATE_LOG_LEVEL_WARNING = 2, 33 WEB_CONTENTS_DELEGATE_LOG_LEVEL_WARNING = 2,
37 // Equivalent of WebCore::WebConsoleMessage::LevelError. 34 // Equivalent of WebCore::WebConsoleMessage::LevelError.
38 WEB_CONTENTS_DELEGATE_LOG_LEVEL_ERROR = 3, 35 WEB_CONTENTS_DELEGATE_LOG_LEVEL_ERROR = 3,
39 }; 36 };
40 37
41 38
42 // Native underpinnings of WebContentsDelegateAndroid.java. Provides a default 39 // Native underpinnings of WebContentsDelegateAndroid.java. Provides a default
43 // delegate for WebContents to forward calls to the java peer. The embedding 40 // delegate for WebContents to forward calls to the java peer. The embedding
44 // application may subclass and override methods on either the C++ or Java side 41 // application may subclass and override methods on either the C++ or Java side
45 // as required. 42 // as required.
46 class WebContentsDelegateAndroid : public content::WebContentsDelegate { 43 class WebContentsDelegateAndroid : public content::WebContentsDelegate {
jam 2012/11/12 17:24:40 nit: get rid of content:: everywhere
John Knottenbelt 2012/11/12 18:07:46 Done.
47 public: 44 public:
48 WebContentsDelegateAndroid(JNIEnv* env, jobject obj); 45 WebContentsDelegateAndroid(JNIEnv* env, jobject obj);
49 virtual ~WebContentsDelegateAndroid(); 46 virtual ~WebContentsDelegateAndroid();
50 47
51 // Binds this WebContentsDelegateAndroid to the passed WebContents instance, 48 // Binds this WebContentsDelegateAndroid to the passed WebContents instance,
52 // such that when that WebContents is destroyed, this 49 // such that when that WebContents is destroyed, this
53 // WebContentsDelegateAndroid instance will be destroyed too. 50 // WebContentsDelegateAndroid instance will be destroyed too.
54 void SetOwnerWebContents(content::WebContents* contents); 51 void SetOwnerWebContents(content::WebContents* contents);
55 52
56 // Overridden from WebContentsDelegate: 53 // Overridden from WebContentsDelegate:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 95
99 private: 96 private:
100 // We depend on the java side user of WebContentDelegateAndroid to hold a 97 // We depend on the java side user of WebContentDelegateAndroid to hold a
101 // strong reference to that object as long as they want to receive callbacks 98 // strong reference to that object as long as they want to receive callbacks
102 // on it. Using a weak ref here allows it to be correctly GCed. 99 // on it. Using a weak ref here allows it to be correctly GCed.
103 JavaObjectWeakGlobalRef weak_java_delegate_; 100 JavaObjectWeakGlobalRef weak_java_delegate_;
104 }; 101 };
105 102
106 bool RegisterWebContentsDelegateAndroid(JNIEnv* env); 103 bool RegisterWebContentsDelegateAndroid(JNIEnv* env);
107 104
108 } // namespace web_contents_delegate_android 105 } // namespace content
109 106
110 #endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_D ELEGATE_ANDROID_H_ 107 #endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_D ELEGATE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698