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_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_IMPL_H_ |
6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_IMPL_H_ | 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/android/jni_helper.h" | 9 #include "base/android/jni_helper.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void OnSelectionChanged(const std::string& text); | 72 void OnSelectionChanged(const std::string& text); |
73 void OnSelectionBoundsChanged(int startx, | 73 void OnSelectionBoundsChanged(int startx, |
74 int starty, | 74 int starty, |
75 base::i18n::TextDirection start_dir, | 75 base::i18n::TextDirection start_dir, |
76 int endx, | 76 int endx, |
77 int endy, | 77 int endy, |
78 base::i18n::TextDirection end_dir); | 78 base::i18n::TextDirection end_dir); |
79 void OnAcceleratedCompositingStateChange(RenderWidgetHostViewAndroid* rwhva, | 79 void OnAcceleratedCompositingStateChange(RenderWidgetHostViewAndroid* rwhva, |
80 bool activated, | 80 bool activated, |
81 bool force); | 81 bool force); |
| 82 virtual void StartContentIntent(const GURL& content_url) OVERRIDE; |
82 | 83 |
83 // -------------------------------------------------------------------------- | 84 // -------------------------------------------------------------------------- |
84 // Methods called from native code | 85 // Methods called from native code |
85 // -------------------------------------------------------------------------- | 86 // -------------------------------------------------------------------------- |
86 | 87 |
87 gfx::Rect GetBounds() const; | 88 gfx::Rect GetBounds() const; |
88 | 89 |
89 WebContents* web_contents() const { return web_contents_; } | 90 WebContents* web_contents() const { return web_contents_; } |
90 void LoadUrl(const GURL& url, int page_transition); | 91 void LoadUrl(const GURL& url, int page_transition); |
91 void LoadUrlWithUserAgentOverride( | 92 void LoadUrlWithUserAgentOverride( |
92 const GURL& url, | 93 const GURL& url, |
93 int page_transition, | 94 int page_transition, |
94 const std::string& user_agent_override); | 95 const std::string& user_agent_override); |
95 | 96 |
96 private: | 97 private: |
97 // NotificationObserver implementation. | 98 // NotificationObserver implementation. |
98 virtual void Observe(int type, | 99 virtual void Observe(int type, |
99 const NotificationSource& source, | 100 const NotificationSource& source, |
100 const NotificationDetails& details) OVERRIDE; | 101 const NotificationDetails& details) OVERRIDE; |
101 | 102 |
102 // -------------------------------------------------------------------------- | 103 // -------------------------------------------------------------------------- |
103 // Private methods that call to Java via JNI | 104 // Private methods that call to Java via JNI |
104 // -------------------------------------------------------------------------- | 105 // -------------------------------------------------------------------------- |
105 virtual ~ContentViewImpl(); | 106 virtual ~ContentViewImpl(); |
106 | 107 |
107 // -------------------------------------------------------------------------- | 108 // -------------------------------------------------------------------------- |
108 // Other private methods and data | 109 // Other private methods and data |
109 // -------------------------------------------------------------------------- | 110 // -------------------------------------------------------------------------- |
110 | 111 |
| 112 void InitJNI(JNIEnv* env, jobject obj); |
| 113 |
111 void PostLoadUrl(const GURL& url); | 114 void PostLoadUrl(const GURL& url); |
112 | 115 |
| 116 struct JavaObject; |
| 117 JavaObject* java_object_; |
| 118 |
113 // Reference to the current WebContents used to determine how and what to | 119 // Reference to the current WebContents used to determine how and what to |
114 // display in the ContentView. | 120 // display in the ContentView. |
115 WebContents* web_contents_; | 121 WebContents* web_contents_; |
116 | 122 |
117 // We only set this to be the delegate of the web_contents if we own it. | 123 // We only set this to be the delegate of the web_contents if we own it. |
118 scoped_ptr<ContentViewClient> content_view_client_; | 124 scoped_ptr<ContentViewClient> content_view_client_; |
119 | 125 |
120 // Whether the renderer backing this ContentView has crashed. | 126 // Whether the renderer backing this ContentView has crashed. |
121 bool tab_crashed_; | 127 bool tab_crashed_; |
122 | 128 |
123 DISALLOW_COPY_AND_ASSIGN(ContentViewImpl); | 129 DISALLOW_COPY_AND_ASSIGN(ContentViewImpl); |
124 }; | 130 }; |
125 | 131 |
126 bool RegisterContentView(JNIEnv* env); | 132 bool RegisterContentView(JNIEnv* env); |
127 | 133 |
128 }; // namespace content | 134 }; // namespace content |
129 | 135 |
130 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_IMPL_H_ | 136 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_IMPL_H_ |
OLD | NEW |