| 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" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class WebContents; | 49 class WebContents; |
| 50 | 50 |
| 51 // This represents one window of the Content Shell, i.e. all the UI including | 51 // 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. | 52 // buttons and url bar, as well as the web content area. |
| 53 class Shell : public WebContentsDelegate, | 53 class Shell : public WebContentsDelegate, |
| 54 public WebContentsObserver { | 54 public WebContentsObserver { |
| 55 public: | 55 public: |
| 56 static const int kDefaultTestWindowWidthDip; | 56 static const int kDefaultTestWindowWidthDip; |
| 57 static const int kDefaultTestWindowHeightDip; | 57 static const int kDefaultTestWindowHeightDip; |
| 58 | 58 |
| 59 virtual ~Shell(); | 59 ~Shell() override; |
| 60 | 60 |
| 61 void LoadURL(const GURL& url); | 61 void LoadURL(const GURL& url); |
| 62 void LoadURLForFrame(const GURL& url, const std::string& frame_name); | 62 void LoadURLForFrame(const GURL& url, const std::string& frame_name); |
| 63 void LoadDataWithBaseURL(const GURL& url, | 63 void LoadDataWithBaseURL(const GURL& url, |
| 64 const std::string& data, | 64 const std::string& data, |
| 65 const GURL& base_url); | 65 const GURL& base_url); |
| 66 void GoBackOrForward(int offset); | 66 void GoBackOrForward(int offset); |
| 67 void Reload(); | 67 void Reload(); |
| 68 void Stop(); | 68 void Stop(); |
| 69 void UpdateNavigationControls(bool to_different_document); | 69 void UpdateNavigationControls(bool to_different_document); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 #if defined(OS_MACOSX) | 106 #if defined(OS_MACOSX) |
| 107 // Public to be called by an ObjC bridge object. | 107 // Public to be called by an ObjC bridge object. |
| 108 void ActionPerformed(int control); | 108 void ActionPerformed(int control); |
| 109 void URLEntered(std::string url_string); | 109 void URLEntered(std::string url_string); |
| 110 #elif defined(OS_ANDROID) | 110 #elif defined(OS_ANDROID) |
| 111 // Registers the Android Java to native methods. | 111 // Registers the Android Java to native methods. |
| 112 static bool Register(JNIEnv* env); | 112 static bool Register(JNIEnv* env); |
| 113 #endif | 113 #endif |
| 114 | 114 |
| 115 // WebContentsDelegate | 115 // WebContentsDelegate |
| 116 virtual WebContents* OpenURLFromTab(WebContents* source, | 116 WebContents* OpenURLFromTab(WebContents* source, |
| 117 const OpenURLParams& params) override; | 117 const OpenURLParams& params) override; |
| 118 virtual void AddNewContents(WebContents* source, | 118 void AddNewContents(WebContents* source, |
| 119 WebContents* new_contents, | 119 WebContents* new_contents, |
| 120 WindowOpenDisposition disposition, | 120 WindowOpenDisposition disposition, |
| 121 const gfx::Rect& initial_pos, | 121 const gfx::Rect& initial_pos, |
| 122 bool user_gesture, | 122 bool user_gesture, |
| 123 bool* was_blocked) override; | 123 bool* was_blocked) override; |
| 124 virtual void LoadingStateChanged(WebContents* source, | 124 void LoadingStateChanged(WebContents* source, |
| 125 bool to_different_document) override; | 125 bool to_different_document) override; |
| 126 #if defined(OS_ANDROID) | 126 #if defined(OS_ANDROID) |
| 127 virtual void LoadProgressChanged(WebContents* source, | 127 virtual void LoadProgressChanged(WebContents* source, |
| 128 double progress) override; | 128 double progress) override; |
| 129 #endif | 129 #endif |
| 130 virtual void ToggleFullscreenModeForTab(WebContents* web_contents, | 130 void ToggleFullscreenModeForTab(WebContents* web_contents, |
| 131 bool enter_fullscreen) override; | 131 bool enter_fullscreen) override; |
| 132 virtual bool IsFullscreenForTabOrPending( | 132 bool IsFullscreenForTabOrPending( |
| 133 const WebContents* web_contents) const override; | 133 const WebContents* web_contents) const override; |
| 134 virtual void RequestToLockMouse(WebContents* web_contents, | 134 void RequestToLockMouse(WebContents* web_contents, |
| 135 bool user_gesture, | 135 bool user_gesture, |
| 136 bool last_unlocked_by_target) override; | 136 bool last_unlocked_by_target) override; |
| 137 virtual void CloseContents(WebContents* source) override; | 137 void CloseContents(WebContents* source) override; |
| 138 virtual bool CanOverscrollContent() const override; | 138 bool CanOverscrollContent() const override; |
| 139 virtual void DidNavigateMainFramePostCommit( | 139 void DidNavigateMainFramePostCommit(WebContents* web_contents) override; |
| 140 WebContents* web_contents) override; | 140 JavaScriptDialogManager* GetJavaScriptDialogManager() override; |
| 141 virtual JavaScriptDialogManager* GetJavaScriptDialogManager() override; | |
| 142 #if defined(OS_MACOSX) | 141 #if defined(OS_MACOSX) |
| 143 virtual void HandleKeyboardEvent( | 142 void HandleKeyboardEvent(WebContents* source, |
| 144 WebContents* source, | 143 const NativeWebKeyboardEvent& event) override; |
| 145 const NativeWebKeyboardEvent& event) override; | |
| 146 #endif | 144 #endif |
| 147 virtual bool AddMessageToConsole(WebContents* source, | 145 bool AddMessageToConsole(WebContents* source, |
| 148 int32 level, | 146 int32 level, |
| 149 const base::string16& message, | 147 const base::string16& message, |
| 150 int32 line_no, | 148 int32 line_no, |
| 151 const base::string16& source_id) override; | 149 const base::string16& source_id) override; |
| 152 virtual void RendererUnresponsive(WebContents* source) override; | 150 void RendererUnresponsive(WebContents* source) override; |
| 153 virtual void ActivateContents(WebContents* contents) override; | 151 void ActivateContents(WebContents* contents) override; |
| 154 virtual void DeactivateContents(WebContents* contents) override; | 152 void DeactivateContents(WebContents* contents) override; |
| 155 virtual void WorkerCrashed(WebContents* source) override; | 153 void WorkerCrashed(WebContents* source) override; |
| 156 virtual bool HandleContextMenu(const content::ContextMenuParams& params) | 154 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 157 override; | 155 void WebContentsFocused(WebContents* contents) override; |
| 158 virtual void WebContentsFocused(WebContents* contents) override; | |
| 159 | 156 |
| 160 private: | 157 private: |
| 161 enum UIControl { | 158 enum UIControl { |
| 162 BACK_BUTTON, | 159 BACK_BUTTON, |
| 163 FORWARD_BUTTON, | 160 FORWARD_BUTTON, |
| 164 STOP_BUTTON | 161 STOP_BUTTON |
| 165 }; | 162 }; |
| 166 | 163 |
| 167 class DevToolsWebContentsObserver; | 164 class DevToolsWebContentsObserver; |
| 168 | 165 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 bool PlatformIsFullscreenForTabOrPending( | 204 bool PlatformIsFullscreenForTabOrPending( |
| 208 const WebContents* web_contents) const; | 205 const WebContents* web_contents) const; |
| 209 #endif | 206 #endif |
| 210 #if defined(TOOLKIT_VIEWS) | 207 #if defined(TOOLKIT_VIEWS) |
| 211 void PlatformWebContentsFocused(WebContents* contents); | 208 void PlatformWebContentsFocused(WebContents* contents); |
| 212 #endif | 209 #endif |
| 213 | 210 |
| 214 gfx::NativeView GetContentView(); | 211 gfx::NativeView GetContentView(); |
| 215 | 212 |
| 216 // WebContentsObserver | 213 // WebContentsObserver |
| 217 virtual void TitleWasSet(NavigationEntry* entry, bool explicit_set) override; | 214 void TitleWasSet(NavigationEntry* entry, bool explicit_set) override; |
| 218 | 215 |
| 219 void InnerShowDevTools(const std::string& settings, | 216 void InnerShowDevTools(const std::string& settings, |
| 220 const std::string& frontend_url); | 217 const std::string& frontend_url); |
| 221 void OnDevToolsWebContentsDestroyed(); | 218 void OnDevToolsWebContentsDestroyed(); |
| 222 | 219 |
| 223 scoped_ptr<ShellJavaScriptDialogManager> dialog_manager_; | 220 scoped_ptr<ShellJavaScriptDialogManager> dialog_manager_; |
| 224 | 221 |
| 225 scoped_ptr<WebContents> web_contents_; | 222 scoped_ptr<WebContents> web_contents_; |
| 226 | 223 |
| 227 scoped_ptr<DevToolsWebContentsObserver> devtools_observer_; | 224 scoped_ptr<DevToolsWebContentsObserver> devtools_observer_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 258 static base::Callback<void(Shell*)> shell_created_callback_; | 255 static base::Callback<void(Shell*)> shell_created_callback_; |
| 259 | 256 |
| 260 // True if the destructur of Shell should post a quit closure on the current | 257 // True if the destructur of Shell should post a quit closure on the current |
| 261 // message loop if the destructed Shell object was the last one. | 258 // message loop if the destructed Shell object was the last one. |
| 262 static bool quit_message_loop_; | 259 static bool quit_message_loop_; |
| 263 }; | 260 }; |
| 264 | 261 |
| 265 } // namespace content | 262 } // namespace content |
| 266 | 263 |
| 267 #endif // CONTENT_SHELL_BROWSER_SHELL_H_ | 264 #endif // CONTENT_SHELL_BROWSER_SHELL_H_ |
| OLD | NEW |