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 #pragma once | 8 #pragma once |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/string_piece.h" | 14 #include "base/string_piece.h" |
15 #include "content/public/browser/web_contents_delegate.h" | 15 #include "content/public/browser/web_contents_delegate.h" |
16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
18 | 18 |
19 #if defined(OS_LINUX) | 19 #if defined(TOOLKIT_GTK) |
20 #include <gtk/gtk.h> | 20 #include <gtk/gtk.h> |
21 #include "ui/base/gtk/gtk_signal.h" | 21 #include "ui/base/gtk/gtk_signal.h" |
22 | 22 |
23 typedef struct _GtkToolItem GtkToolItem; | 23 typedef struct _GtkToolItem GtkToolItem; |
24 #endif | 24 #endif |
25 | 25 |
26 class GURL; | 26 class GURL; |
27 class WebContents; | 27 class WebContents; |
28 | 28 |
29 namespace content { | 29 namespace content { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void PlatformSetContents(); | 100 void PlatformSetContents(); |
101 // Resize the content area and GUI. | 101 // Resize the content area and GUI. |
102 void PlatformResizeSubViews(); | 102 void PlatformResizeSubViews(); |
103 // Enable/disable a button. | 103 // Enable/disable a button. |
104 void PlatformEnableUIControl(UIControl control, bool is_enabled); | 104 void PlatformEnableUIControl(UIControl control, bool is_enabled); |
105 // Updates the url in the url bar. | 105 // Updates the url in the url bar. |
106 void PlatformSetAddressBarURL(const GURL& url); | 106 void PlatformSetAddressBarURL(const GURL& url); |
107 // Sets whether the spinner is spinning. | 107 // Sets whether the spinner is spinning. |
108 void PlatformSetIsLoading(bool loading); | 108 void PlatformSetIsLoading(bool loading); |
109 | 109 |
110 #if defined(OS_WIN) || defined(OS_LINUX) | 110 #if (defined(OS_WIN) && !defined(USE_AURA)) || defined(TOOLKIT_GTK) |
111 // Resizes the main window to the given dimensions. | 111 // Resizes the main window to the given dimensions. |
112 void SizeTo(int width, int height); | 112 void SizeTo(int width, int height); |
113 #endif | 113 #endif |
114 | 114 |
115 gfx::NativeView GetContentView(); | 115 gfx::NativeView GetContentView(); |
116 | 116 |
117 // content::WebContentsDelegate | 117 // content::WebContentsDelegate |
118 virtual void LoadingStateChanged(WebContents* source) OVERRIDE; | 118 virtual void LoadingStateChanged(WebContents* source) OVERRIDE; |
119 virtual void WebContentsCreated(WebContents* source_contents, | 119 virtual void WebContentsCreated(WebContents* source_contents, |
120 int64 source_frame_id, | 120 int64 source_frame_id, |
121 const GURL& target_url, | 121 const GURL& target_url, |
122 WebContents* new_contents) OVERRIDE; | 122 WebContents* new_contents) OVERRIDE; |
123 virtual void DidNavigateMainFramePostCommit(WebContents* tab) OVERRIDE; | 123 virtual void DidNavigateMainFramePostCommit(WebContents* tab) OVERRIDE; |
124 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; | 124 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; |
125 #if defined(OS_MACOSX) | 125 #if defined(OS_MACOSX) |
126 virtual void HandleKeyboardEvent( | 126 virtual void HandleKeyboardEvent( |
127 const NativeWebKeyboardEvent& event) OVERRIDE; | 127 const NativeWebKeyboardEvent& event) OVERRIDE; |
128 #endif | 128 #endif |
129 | 129 |
130 // content::WebContentsObserver | 130 // content::WebContentsObserver |
131 virtual void DidFinishLoad(int64 frame_id, | 131 virtual void DidFinishLoad(int64 frame_id, |
132 const GURL& validated_url, | 132 const GURL& validated_url, |
133 bool is_main_frame) OVERRIDE; | 133 bool is_main_frame) OVERRIDE; |
134 | 134 |
135 #if defined(OS_WIN) | 135 #if defined(OS_WIN) && !defined(USE_AURA) |
136 static ATOM RegisterWindowClass(); | 136 static ATOM RegisterWindowClass(); |
137 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); | 137 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); |
138 static LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM); | 138 static LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM); |
139 #elif defined(OS_LINUX) | 139 #elif defined(TOOLKIT_GTK) |
140 CHROMEGTK_CALLBACK_0(Shell, void, OnBackButtonClicked); | 140 CHROMEGTK_CALLBACK_0(Shell, void, OnBackButtonClicked); |
141 CHROMEGTK_CALLBACK_0(Shell, void, OnForwardButtonClicked); | 141 CHROMEGTK_CALLBACK_0(Shell, void, OnForwardButtonClicked); |
142 CHROMEGTK_CALLBACK_0(Shell, void, OnReloadButtonClicked); | 142 CHROMEGTK_CALLBACK_0(Shell, void, OnReloadButtonClicked); |
143 CHROMEGTK_CALLBACK_0(Shell, void, OnStopButtonClicked); | 143 CHROMEGTK_CALLBACK_0(Shell, void, OnStopButtonClicked); |
144 CHROMEGTK_CALLBACK_0(Shell, void, OnURLEntryActivate); | 144 CHROMEGTK_CALLBACK_0(Shell, void, OnURLEntryActivate); |
145 CHROMEGTK_CALLBACK_0(Shell, gboolean, OnWindowDestroyed); | 145 CHROMEGTK_CALLBACK_0(Shell, gboolean, OnWindowDestroyed); |
146 | 146 |
147 CHROMEG_CALLBACK_3(Shell, gboolean, OnCloseWindowKeyPressed, GtkAccelGroup*, | 147 CHROMEG_CALLBACK_3(Shell, gboolean, OnCloseWindowKeyPressed, GtkAccelGroup*, |
148 GObject*, guint, GdkModifierType); | 148 GObject*, guint, GdkModifierType); |
149 CHROMEG_CALLBACK_3(Shell, gboolean, OnHighlightURLView, GtkAccelGroup*, | 149 CHROMEG_CALLBACK_3(Shell, gboolean, OnHighlightURLView, GtkAccelGroup*, |
150 GObject*, guint, GdkModifierType); | 150 GObject*, guint, GdkModifierType); |
151 #endif | 151 #endif |
152 | 152 |
153 scoped_ptr<ShellJavaScriptDialogCreator> dialog_creator_; | 153 scoped_ptr<ShellJavaScriptDialogCreator> dialog_creator_; |
154 | 154 |
155 scoped_ptr<WebContents> web_contents_; | 155 scoped_ptr<WebContents> web_contents_; |
156 | 156 |
157 // layoutTestController related variables. | 157 // layoutTestController related variables. |
158 bool wait_until_done_; | 158 bool wait_until_done_; |
159 | 159 |
160 gfx::NativeWindow window_; | 160 gfx::NativeWindow window_; |
161 gfx::NativeEditView url_edit_view_; | 161 gfx::NativeEditView url_edit_view_; |
162 | 162 |
163 #if defined(OS_WIN) | 163 #if defined(OS_WIN) && !defined(USE_AURA) |
164 WNDPROC default_edit_wnd_proc_; | 164 WNDPROC default_edit_wnd_proc_; |
165 static HINSTANCE instance_handle_; | 165 static HINSTANCE instance_handle_; |
166 #elif defined(OS_LINUX) | 166 #elif defined(TOOLKIT_GTK) |
167 GtkWidget* vbox_; | 167 GtkWidget* vbox_; |
168 | 168 |
169 GtkToolItem* back_button_; | 169 GtkToolItem* back_button_; |
170 GtkToolItem* forward_button_; | 170 GtkToolItem* forward_button_; |
171 GtkToolItem* reload_button_; | 171 GtkToolItem* reload_button_; |
172 GtkToolItem* stop_button_; | 172 GtkToolItem* stop_button_; |
173 | 173 |
174 GtkWidget* spinner_; | 174 GtkWidget* spinner_; |
175 GtkToolItem* spinner_item_; | 175 GtkToolItem* spinner_item_; |
176 | 176 |
177 int content_width_; | 177 int content_width_; |
178 int content_height_; | 178 int content_height_; |
179 #endif | 179 #endif |
180 | 180 |
181 // A container of all the open windows. We use a vector so we can keep track | 181 // A container of all the open windows. We use a vector so we can keep track |
182 // of ordering. | 182 // of ordering. |
183 static std::vector<Shell*> windows_; | 183 static std::vector<Shell*> windows_; |
184 | 184 |
185 // True if the destructur of Shell should post a quit closure on the current | 185 // True if the destructur of Shell should post a quit closure on the current |
186 // message loop if the destructed Shell object was the last one. | 186 // message loop if the destructed Shell object was the last one. |
187 static bool quit_message_loop_; | 187 static bool quit_message_loop_; |
188 }; | 188 }; |
189 | 189 |
190 } // namespace content | 190 } // namespace content |
191 | 191 |
192 #endif // CONTENT_SHELL_SHELL_H_ | 192 #endif // CONTENT_SHELL_SHELL_H_ |
OLD | NEW |