| 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_SHELL_SHELL_H_ | 5 #ifndef CONTENT_SHELL_SHELL_H_ |
| 6 #define CONTENT_SHELL_SHELL_H_ | 6 #define CONTENT_SHELL_SHELL_H_ |
| 7 | 7 |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
| 17 #include "ipc/ipc_channel.h" | 17 #include "ipc/ipc_channel.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
| 19 | 19 |
| 20 #if defined(TOOLKIT_GTK) | 20 #if defined(TOOLKIT_GTK) |
| 21 #include <gtk/gtk.h> | 21 #include <gtk/gtk.h> |
| 22 #include "ui/base/gtk/gtk_signal.h" | 22 #include "ui/base/gtk/gtk_signal.h" |
| 23 | 23 |
| 24 typedef struct _GtkToolItem GtkToolItem; | 24 typedef struct _GtkToolItem GtkToolItem; |
| 25 #elif defined(OS_ANDROID) | 25 #elif defined(OS_ANDROID) |
| 26 #include "content/shell/android/shell_view.h" | 26 #include "base/android/scoped_java_ref.h" |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 class GURL; | 29 class GURL; |
| 30 class WebContents; | 30 class WebContents; |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 | 33 |
| 34 class BrowserContext; | 34 class BrowserContext; |
| 35 class ShellJavaScriptDialogCreator; | 35 class ShellJavaScriptDialogCreator; |
| 36 class SiteInstance; | 36 class SiteInstance; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // Closes all windows and exits. | 70 // Closes all windows and exits. |
| 71 static void PlatformExit(); | 71 static void PlatformExit(); |
| 72 | 72 |
| 73 WebContents* web_contents() const { return web_contents_.get(); } | 73 WebContents* web_contents() const { return web_contents_.get(); } |
| 74 | 74 |
| 75 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
| 76 // Public to be called by an ObjC bridge object. | 76 // Public to be called by an ObjC bridge object. |
| 77 void ActionPerformed(int control); | 77 void ActionPerformed(int control); |
| 78 void URLEntered(std::string url_string); | 78 void URLEntered(std::string url_string); |
| 79 #elif defined(OS_ANDROID) |
| 80 // Registers the Android Java to native methods. |
| 81 static bool Register(JNIEnv* env); |
| 79 #endif | 82 #endif |
| 80 | 83 |
| 81 private: | 84 private: |
| 82 enum UIControl { | 85 enum UIControl { |
| 83 BACK_BUTTON, | 86 BACK_BUTTON, |
| 84 FORWARD_BUTTON, | 87 FORWARD_BUTTON, |
| 85 STOP_BUTTON | 88 STOP_BUTTON |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 explicit Shell(WebContents* web_contents); | 91 explicit Shell(WebContents* web_contents); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 111 | 114 |
| 112 #if (defined(OS_WIN) && !defined(USE_AURA)) || defined(TOOLKIT_GTK) | 115 #if (defined(OS_WIN) && !defined(USE_AURA)) || defined(TOOLKIT_GTK) |
| 113 // Resizes the main window to the given dimensions. | 116 // Resizes the main window to the given dimensions. |
| 114 void SizeTo(int width, int height); | 117 void SizeTo(int width, int height); |
| 115 #endif | 118 #endif |
| 116 | 119 |
| 117 gfx::NativeView GetContentView(); | 120 gfx::NativeView GetContentView(); |
| 118 | 121 |
| 119 // content::WebContentsDelegate | 122 // content::WebContentsDelegate |
| 120 virtual void LoadingStateChanged(WebContents* source) OVERRIDE; | 123 virtual void LoadingStateChanged(WebContents* source) OVERRIDE; |
| 124 #if defined(OS_ANDROID) |
| 125 virtual void LoadProgressChanged(double progress) OVERRIDE; |
| 126 #endif |
| 121 virtual void WebContentsCreated(WebContents* source_contents, | 127 virtual void WebContentsCreated(WebContents* source_contents, |
| 122 int64 source_frame_id, | 128 int64 source_frame_id, |
| 123 const GURL& target_url, | 129 const GURL& target_url, |
| 124 WebContents* new_contents) OVERRIDE; | 130 WebContents* new_contents) OVERRIDE; |
| 125 virtual void DidNavigateMainFramePostCommit( | 131 virtual void DidNavigateMainFramePostCommit( |
| 126 WebContents* web_contents) OVERRIDE; | 132 WebContents* web_contents) OVERRIDE; |
| 127 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; | 133 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; |
| 128 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
| 129 virtual void HandleKeyboardEvent( | 135 virtual void HandleKeyboardEvent( |
| 130 const NativeWebKeyboardEvent& event) OVERRIDE; | 136 const NativeWebKeyboardEvent& event) OVERRIDE; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 GtkToolItem* forward_button_; | 184 GtkToolItem* forward_button_; |
| 179 GtkToolItem* reload_button_; | 185 GtkToolItem* reload_button_; |
| 180 GtkToolItem* stop_button_; | 186 GtkToolItem* stop_button_; |
| 181 | 187 |
| 182 GtkWidget* spinner_; | 188 GtkWidget* spinner_; |
| 183 GtkToolItem* spinner_item_; | 189 GtkToolItem* spinner_item_; |
| 184 | 190 |
| 185 int content_width_; | 191 int content_width_; |
| 186 int content_height_; | 192 int content_height_; |
| 187 #elif defined(OS_ANDROID) | 193 #elif defined(OS_ANDROID) |
| 188 scoped_ptr<ShellView> shell_view_; | 194 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
| 189 #endif | 195 #endif |
| 190 | 196 |
| 191 // A container of all the open windows. We use a vector so we can keep track | 197 // A container of all the open windows. We use a vector so we can keep track |
| 192 // of ordering. | 198 // of ordering. |
| 193 static std::vector<Shell*> windows_; | 199 static std::vector<Shell*> windows_; |
| 194 | 200 |
| 195 // True if the destructur of Shell should post a quit closure on the current | 201 // True if the destructur of Shell should post a quit closure on the current |
| 196 // message loop if the destructed Shell object was the last one. | 202 // message loop if the destructed Shell object was the last one. |
| 197 static bool quit_message_loop_; | 203 static bool quit_message_loop_; |
| 198 }; | 204 }; |
| 199 | 205 |
| 200 } // namespace content | 206 } // namespace content |
| 201 | 207 |
| 202 #endif // CONTENT_SHELL_SHELL_H_ | 208 #endif // CONTENT_SHELL_SHELL_H_ |
| OLD | NEW |