| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_SHELL_BROWSER_SHELL_H_ | 4 #ifndef CONTENT_SHELL_BROWSER_SHELL_H_ |
| 5 #define CONTENT_SHELL_BROWSER_SHELL_H_ | 5 #define CONTENT_SHELL_BROWSER_SHELL_H_ |
| 6 | 6 |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.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 "ipc/ipc_channel.h" | 17 #include "ipc/ipc_channel.h" |
| 18 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
| 19 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 20 | 20 |
| 21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
| 22 #include "base/android/scoped_java_ref.h" | 22 #include "base/android/scoped_java_ref.h" |
| 23 #elif defined(USE_AURA) | 23 #endif |
| 24 #if defined(OS_CHROMEOS) | 24 #if defined(USE_AURA) && defined(OS_ANDROID) |
| 25 #include "ui/aura/env_observer.h" |
| 26 #endif |
| 27 #if defined(USE_AURA) |
| 28 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
| 25 namespace gfx { | 29 namespace gfx { |
| 26 class Screen; | 30 class Screen; |
| 27 } | 31 } |
| 28 namespace wm { | 32 namespace wm { |
| 29 class WMTestHelper; | 33 class WMTestHelper; |
| 30 } | 34 } |
| 31 #endif // defined(OS_CHROMEOS) | 35 #endif // defined(OS_CHROMEOS) |
| 32 namespace views { | 36 namespace views { |
| 33 class Widget; | 37 class Widget; |
| 34 class ViewsDelegate; | 38 class ViewsDelegate; |
| 35 } | 39 } |
| 36 #endif // defined(USE_AURA) | 40 #endif // defined(USE_AURA) |
| 37 | 41 |
| 38 class GURL; | 42 class GURL; |
| 39 namespace content { | 43 namespace content { |
| 40 | 44 |
| 41 #if defined(USE_AURA) | 45 #if defined(USE_AURA) |
| 42 class ShellPlatformDataAura; | 46 class ShellPlatformDataAura; |
| 43 #endif | 47 #endif |
| 44 | 48 |
| 45 class BrowserContext; | 49 class BrowserContext; |
| 46 class ShellDevToolsFrontend; | 50 class ShellDevToolsFrontend; |
| 47 class ShellJavaScriptDialogManager; | 51 class ShellJavaScriptDialogManager; |
| 48 class SiteInstance; | 52 class SiteInstance; |
| 49 class WebContents; | 53 class WebContents; |
| 50 | 54 |
| 51 // This represents one window of the Content Shell, i.e. all the UI including | 55 // This represents one window of the Content Shell, i.e. all the UI including |
| 52 // buttons and url bar, as well as the web content area. | 56 // buttons and url bar, as well as the web content area. |
| 53 class Shell : public WebContentsDelegate, | 57 class Shell : public WebContentsDelegate, |
| 54 public WebContentsObserver { | 58 #if defined(USE_AURA) && defined(OS_ANDROID) |
| 59 public aura::EnvObserver, |
| 60 #endif |
| 61 public WebContentsObserver |
| 62 |
| 63 { |
| 55 public: | 64 public: |
| 56 ~Shell() override; | 65 ~Shell() override; |
| 57 | 66 |
| 58 void LoadURL(const GURL& url); | 67 void LoadURL(const GURL& url); |
| 59 void LoadURLForFrame(const GURL& url, const std::string& frame_name); | 68 void LoadURLForFrame(const GURL& url, const std::string& frame_name); |
| 60 void LoadDataWithBaseURL(const GURL& url, | 69 void LoadDataWithBaseURL(const GURL& url, |
| 61 const std::string& data, | 70 const std::string& data, |
| 62 const GURL& base_url); | 71 const GURL& base_url); |
| 63 void GoBackOrForward(int offset); | 72 void GoBackOrForward(int offset); |
| 64 void Reload(); | 73 void Reload(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 WebContents* OpenURLFromTab(WebContents* source, | 119 WebContents* OpenURLFromTab(WebContents* source, |
| 111 const OpenURLParams& params) override; | 120 const OpenURLParams& params) override; |
| 112 void AddNewContents(WebContents* source, | 121 void AddNewContents(WebContents* source, |
| 113 WebContents* new_contents, | 122 WebContents* new_contents, |
| 114 WindowOpenDisposition disposition, | 123 WindowOpenDisposition disposition, |
| 115 const gfx::Rect& initial_rect, | 124 const gfx::Rect& initial_rect, |
| 116 bool user_gesture, | 125 bool user_gesture, |
| 117 bool* was_blocked) override; | 126 bool* was_blocked) override; |
| 118 void LoadingStateChanged(WebContents* source, | 127 void LoadingStateChanged(WebContents* source, |
| 119 bool to_different_document) override; | 128 bool to_different_document) override; |
| 120 #if defined(OS_ANDROID) | 129 #if defined(OS_ANDROID) && !defined(USE_AURA) |
| 121 void LoadProgressChanged(WebContents* source, double progress) override; | 130 void LoadProgressChanged(WebContents* source, double progress) override; |
| 122 #endif | 131 #endif |
| 123 void EnterFullscreenModeForTab(WebContents* web_contents, | 132 void EnterFullscreenModeForTab(WebContents* web_contents, |
| 124 const GURL& origin) override; | 133 const GURL& origin) override; |
| 125 void ExitFullscreenModeForTab(WebContents* web_contents) override; | 134 void ExitFullscreenModeForTab(WebContents* web_contents) override; |
| 126 bool IsFullscreenForTabOrPending( | 135 bool IsFullscreenForTabOrPending( |
| 127 const WebContents* web_contents) const override; | 136 const WebContents* web_contents) const override; |
| 128 blink::WebDisplayMode GetDisplayMode( | 137 blink::WebDisplayMode GetDisplayMode( |
| 129 const WebContents* web_contents) const override; | 138 const WebContents* web_contents) const override; |
| 130 void RequestToLockMouse(WebContents* web_contents, | 139 void RequestToLockMouse(WebContents* web_contents, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // Set the title of shell window | 203 // Set the title of shell window |
| 195 void PlatformSetTitle(const base::string16& title); | 204 void PlatformSetTitle(const base::string16& title); |
| 196 // User right-clicked on the web view | 205 // User right-clicked on the web view |
| 197 bool PlatformHandleContextMenu(const content::ContextMenuParams& params); | 206 bool PlatformHandleContextMenu(const content::ContextMenuParams& params); |
| 198 #if defined(OS_ANDROID) | 207 #if defined(OS_ANDROID) |
| 199 void PlatformToggleFullscreenModeForTab(WebContents* web_contents, | 208 void PlatformToggleFullscreenModeForTab(WebContents* web_contents, |
| 200 bool enter_fullscreen); | 209 bool enter_fullscreen); |
| 201 bool PlatformIsFullscreenForTabOrPending( | 210 bool PlatformIsFullscreenForTabOrPending( |
| 202 const WebContents* web_contents) const; | 211 const WebContents* web_contents) const; |
| 203 #endif | 212 #endif |
| 213 #if defined(USE_AURA) && defined(OS_ANDROID) |
| 214 // aura::EnvObserver: |
| 215 void OnWindowInitialized(aura::Window* window) override {} |
| 216 void OnHostInitialized(aura::WindowTreeHost* host) override; |
| 217 #endif |
| 204 | 218 |
| 205 gfx::NativeView GetContentView(); | 219 gfx::NativeView GetContentView(); |
| 206 | 220 |
| 207 void ToggleFullscreenModeForTab(WebContents* web_contents, | 221 void ToggleFullscreenModeForTab(WebContents* web_contents, |
| 208 bool enter_fullscreen); | 222 bool enter_fullscreen); |
| 209 // WebContentsObserver | 223 // WebContentsObserver |
| 210 void TitleWasSet(NavigationEntry* entry, bool explicit_set) override; | 224 void TitleWasSet(NavigationEntry* entry, bool explicit_set) override; |
| 211 | 225 |
| 212 void InnerShowDevTools(); | 226 void InnerShowDevTools(); |
| 213 void OnDevToolsWebContentsDestroyed(); | 227 void OnDevToolsWebContentsDestroyed(); |
| 214 | 228 |
| 215 scoped_ptr<ShellJavaScriptDialogManager> dialog_manager_; | 229 scoped_ptr<ShellJavaScriptDialogManager> dialog_manager_; |
| 216 | 230 |
| 217 scoped_ptr<WebContents> web_contents_; | 231 scoped_ptr<WebContents> web_contents_; |
| 218 | 232 |
| 219 scoped_ptr<DevToolsWebContentsObserver> devtools_observer_; | 233 scoped_ptr<DevToolsWebContentsObserver> devtools_observer_; |
| 220 ShellDevToolsFrontend* devtools_frontend_; | 234 ShellDevToolsFrontend* devtools_frontend_; |
| 221 | 235 |
| 222 bool is_fullscreen_; | 236 bool is_fullscreen_; |
| 223 | 237 |
| 224 gfx::NativeWindow window_; | 238 gfx::NativeWindow window_; |
| 225 gfx::NativeEditView url_edit_view_; | 239 gfx::NativeEditView url_edit_view_; |
| 226 | 240 |
| 227 gfx::Size content_size_; | 241 gfx::Size content_size_; |
| 228 | 242 |
| 229 #if defined(OS_ANDROID) | 243 #if defined(OS_ANDROID) |
| 230 base::android::ScopedJavaGlobalRef<jobject> java_object_; | 244 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
| 231 #elif defined(USE_AURA) | 245 #endif |
| 232 #if defined(OS_CHROMEOS) | 246 #if defined(USE_AURA) |
| 247 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
| 233 static wm::WMTestHelper* wm_test_helper_; | 248 static wm::WMTestHelper* wm_test_helper_; |
| 234 static gfx::Screen* test_screen_; | 249 static gfx::Screen* test_screen_; |
| 235 #endif | 250 #endif |
| 236 #if defined(TOOLKIT_VIEWS) | 251 #if defined(TOOLKIT_VIEWS) |
| 237 static views::ViewsDelegate* views_delegate_; | 252 static views::ViewsDelegate* views_delegate_; |
| 238 | 253 |
| 239 views::Widget* window_widget_; | 254 views::Widget* window_widget_; |
| 240 #endif // defined(TOOLKIT_VIEWS) | 255 #endif // defined(TOOLKIT_VIEWS) |
| 241 static ShellPlatformDataAura* platform_; | 256 static ShellPlatformDataAura* platform_; |
| 242 #endif // defined(USE_AURA) | 257 #endif // defined(USE_AURA) |
| 243 | 258 |
| 244 bool headless_; | 259 bool headless_; |
| 245 | 260 |
| 246 // A container of all the open windows. We use a vector so we can keep track | 261 // A container of all the open windows. We use a vector so we can keep track |
| 247 // of ordering. | 262 // of ordering. |
| 248 static std::vector<Shell*> windows_; | 263 static std::vector<Shell*> windows_; |
| 249 | 264 |
| 250 static base::Callback<void(Shell*)> shell_created_callback_; | 265 static base::Callback<void(Shell*)> shell_created_callback_; |
| 251 | 266 |
| 252 // True if the destructur of Shell should post a quit closure on the current | 267 // True if the destructur of Shell should post a quit closure on the current |
| 253 // message loop if the destructed Shell object was the last one. | 268 // message loop if the destructed Shell object was the last one. |
| 254 static bool quit_message_loop_; | 269 static bool quit_message_loop_; |
| 270 |
| 271 #if defined(USE_AURA) && defined(OS_ANDROID) |
| 272 // Closure for quitting nested message loop. |
| 273 base::Closure quit_closure_; |
| 274 #endif |
| 255 }; | 275 }; |
| 256 | 276 |
| 257 } // namespace content | 277 } // namespace content |
| 258 | 278 |
| 259 #endif // CONTENT_SHELL_BROWSER_SHELL_H_ | 279 #endif // CONTENT_SHELL_BROWSER_SHELL_H_ |
| OLD | NEW |