| 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_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 namespace blink { | 73 namespace blink { |
| 74 class WebGestureEvent; | 74 class WebGestureEvent; |
| 75 } | 75 } |
| 76 | 76 |
| 77 namespace content { | 77 namespace content { |
| 78 | 78 |
| 79 struct OpenURLParams; | 79 struct OpenURLParams; |
| 80 struct WebContentsUnresponsiveState; | 80 struct WebContentsUnresponsiveState; |
| 81 | 81 |
| 82 enum class KeyboardEventProcessingResult; |
| 83 |
| 82 // Objects implement this interface to get notified about changes in the | 84 // Objects implement this interface to get notified about changes in the |
| 83 // WebContents and to provide necessary functionality. | 85 // WebContents and to provide necessary functionality. |
| 84 class CONTENT_EXPORT WebContentsDelegate { | 86 class CONTENT_EXPORT WebContentsDelegate { |
| 85 public: | 87 public: |
| 86 WebContentsDelegate(); | 88 WebContentsDelegate(); |
| 87 | 89 |
| 88 // Opens a new URL inside the passed in WebContents (if source is 0 open | 90 // Opens a new URL inside the passed in WebContents (if source is 0 open |
| 89 // in the current front-most tab), unless |disposition| indicates the url | 91 // in the current front-most tab), unless |disposition| indicates the url |
| 90 // should be opened in a new tab or window. | 92 // should be opened in a new tab or window. |
| 91 // | 93 // |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // Opens source view for given WebContents that is navigated to the given | 254 // Opens source view for given WebContents that is navigated to the given |
| 253 // page url. | 255 // page url. |
| 254 virtual void ViewSourceForTab(WebContents* source, const GURL& page_url); | 256 virtual void ViewSourceForTab(WebContents* source, const GURL& page_url); |
| 255 | 257 |
| 256 // Opens source view for the given subframe. | 258 // Opens source view for the given subframe. |
| 257 virtual void ViewSourceForFrame(WebContents* source, | 259 virtual void ViewSourceForFrame(WebContents* source, |
| 258 const GURL& url, | 260 const GURL& url, |
| 259 const PageState& page_state); | 261 const PageState& page_state); |
| 260 | 262 |
| 261 // Allows delegates to handle keyboard events before sending to the renderer. | 263 // Allows delegates to handle keyboard events before sending to the renderer. |
| 262 // Returns true if the |event| was handled. Otherwise, if the |event| would be | 264 // See enum for description of return values. |
| 263 // handled in HandleKeyboardEvent() method as a normal keyboard shortcut, | 265 virtual KeyboardEventProcessingResult PreHandleKeyboardEvent( |
| 264 // |*is_keyboard_shortcut| should be set to true. | 266 WebContents* source, |
| 265 virtual bool PreHandleKeyboardEvent(WebContents* source, | 267 const NativeWebKeyboardEvent& event); |
| 266 const NativeWebKeyboardEvent& event, | |
| 267 bool* is_keyboard_shortcut); | |
| 268 | 268 |
| 269 // Allows delegates to handle unhandled keyboard messages coming back from | 269 // Allows delegates to handle unhandled keyboard messages coming back from |
| 270 // the renderer. | 270 // the renderer. |
| 271 virtual void HandleKeyboardEvent(WebContents* source, | 271 virtual void HandleKeyboardEvent(WebContents* source, |
| 272 const NativeWebKeyboardEvent& event) {} | 272 const NativeWebKeyboardEvent& event) {} |
| 273 | 273 |
| 274 // Allows delegates to handle gesture events before sending to the renderer. | 274 // Allows delegates to handle gesture events before sending to the renderer. |
| 275 // Returns true if the |event| was handled and thus shouldn't be processed | 275 // Returns true if the |event| was handled and thus shouldn't be processed |
| 276 // by the renderer's event handler. Note that the touch events that create | 276 // by the renderer's event handler. Note that the touch events that create |
| 277 // the gesture are always passed to the renderer since the gesture is created | 277 // the gesture are always passed to the renderer since the gesture is created |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 // Called when |this| is no longer the WebContentsDelegate for |source|. | 581 // Called when |this| is no longer the WebContentsDelegate for |source|. |
| 582 void Detach(WebContents* source); | 582 void Detach(WebContents* source); |
| 583 | 583 |
| 584 // The WebContents that this is currently a delegate for. | 584 // The WebContents that this is currently a delegate for. |
| 585 std::set<WebContents*> attached_contents_; | 585 std::set<WebContents*> attached_contents_; |
| 586 }; | 586 }; |
| 587 | 587 |
| 588 } // namespace content | 588 } // namespace content |
| 589 | 589 |
| 590 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 590 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
| OLD | NEW |