| 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_OBSERVER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/optional.h" | 11 #include "base/optional.h" |
| 12 #include "base/process/kill.h" | 12 #include "base/process/kill.h" |
| 13 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/public/browser/navigation_controller.h" | 15 #include "content/public/browser/navigation_controller.h" |
| 16 #include "content/public/browser/reload_type.h" | 16 #include "content/public/browser/reload_type.h" |
| 17 #include "content/public/common/frame_navigate_params.h" | 17 #include "content/public/common/frame_navigate_params.h" |
| 18 #include "content/public/common/resource_type.h" | 18 #include "content/public/common/resource_type.h" |
| 19 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
| 20 #include "ipc/ipc_sender.h" | 20 #include "ipc/ipc_sender.h" |
| 21 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 21 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 22 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" | |
| 23 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
| 24 #include "ui/base/page_transition_types.h" | 23 #include "ui/base/page_transition_types.h" |
| 25 #include "ui/base/window_open_disposition.h" | 24 #include "ui/base/window_open_disposition.h" |
| 26 | 25 |
| 27 namespace content { | 26 namespace content { |
| 28 | 27 |
| 29 class NavigationEntry; | 28 class NavigationEntry; |
| 30 class NavigationHandle; | 29 class NavigationHandle; |
| 31 class RenderFrameHost; | 30 class RenderFrameHost; |
| 32 class RenderViewHost; | 31 class RenderViewHost; |
| 33 class RenderWidgetHost; | 32 class RenderWidgetHost; |
| 34 class WebContents; | 33 class WebContents; |
| 35 class WebContentsImpl; | 34 class WebContentsImpl; |
| 36 struct AXEventNotificationDetails; | 35 struct AXEventNotificationDetails; |
| 37 struct AXLocationChangeNotificationDetails; | 36 struct AXLocationChangeNotificationDetails; |
| 38 struct FaviconURL; | 37 struct FaviconURL; |
| 39 struct FrameNavigateParams; | 38 struct FrameNavigateParams; |
| 40 struct LoadCommittedDetails; | 39 struct LoadCommittedDetails; |
| 41 struct Referrer; | 40 struct Referrer; |
| 42 struct ResourceRedirectDetails; | 41 struct ResourceRedirectDetails; |
| 43 struct ResourceRequestDetails; | 42 struct ResourceRequestDetails; |
| 44 struct SecurityStyleExplanations; | |
| 45 | 43 |
| 46 // An observer API implemented by classes which are interested in various page | 44 // An observer API implemented by classes which are interested in various page |
| 47 // load events from WebContents. They also get a chance to filter IPC messages. | 45 // load events from WebContents. They also get a chance to filter IPC messages. |
| 48 // | 46 // |
| 49 // Since a WebContents can be a delegate to almost arbitrarily many | 47 // Since a WebContents can be a delegate to almost arbitrarily many |
| 50 // RenderViewHosts, it is important to check in those WebContentsObserver | 48 // RenderViewHosts, it is important to check in those WebContentsObserver |
| 51 // methods which take a RenderViewHost that the event came from the | 49 // methods which take a RenderViewHost that the event came from the |
| 52 // RenderViewHost the observer cares about. | 50 // RenderViewHost the observer cares about. |
| 53 // | 51 // |
| 54 // Usually, observers should only care about the current RenderViewHost as | 52 // Usually, observers should only care about the current RenderViewHost as |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 const GURL& validated_url) {} | 288 const GURL& validated_url) {} |
| 291 | 289 |
| 292 // This method is like DidFinishLoad, but when the load failed or was | 290 // This method is like DidFinishLoad, but when the load failed or was |
| 293 // cancelled, e.g. window.stop() is invoked. | 291 // cancelled, e.g. window.stop() is invoked. |
| 294 virtual void DidFailLoad(RenderFrameHost* render_frame_host, | 292 virtual void DidFailLoad(RenderFrameHost* render_frame_host, |
| 295 const GURL& validated_url, | 293 const GURL& validated_url, |
| 296 int error_code, | 294 int error_code, |
| 297 const base::string16& error_description, | 295 const base::string16& error_description, |
| 298 bool was_ignored_by_handler) {} | 296 bool was_ignored_by_handler) {} |
| 299 | 297 |
| 300 // This method is invoked when the SecurityStyle of the WebContents changes. | 298 // This method is invoked when the visible security state of the page changes. |
| 301 // |security_style| is the new SecurityStyle. |security_style_explanations| | 299 virtual void DidChangeVisibleSecurityState() {} |
| 302 // contains human-readable strings explaining why the SecurityStyle of the | |
| 303 // page has been downgraded. | |
| 304 virtual void SecurityStyleChanged( | |
| 305 blink::WebSecurityStyle security_style, | |
| 306 const SecurityStyleExplanations& security_style_explanations) {} | |
| 307 | 300 |
| 308 // This method is invoked when content was loaded from an in-memory cache. | 301 // This method is invoked when content was loaded from an in-memory cache. |
| 309 virtual void DidLoadResourceFromMemoryCache( | 302 virtual void DidLoadResourceFromMemoryCache( |
| 310 const GURL& url, | 303 const GURL& url, |
| 311 const std::string& mime_type, | 304 const std::string& mime_type, |
| 312 ResourceType resource_type) {} | 305 ResourceType resource_type) {} |
| 313 | 306 |
| 314 // This method is invoked when a response has been received for a resource | 307 // This method is invoked when a response has been received for a resource |
| 315 // request. | 308 // request. |
| 316 virtual void DidGetResourceResponseStart( | 309 virtual void DidGetResourceResponseStart( |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 void ResetWebContents(); | 512 void ResetWebContents(); |
| 520 | 513 |
| 521 WebContentsImpl* web_contents_; | 514 WebContentsImpl* web_contents_; |
| 522 | 515 |
| 523 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); | 516 DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); |
| 524 }; | 517 }; |
| 525 | 518 |
| 526 } // namespace content | 519 } // namespace content |
| 527 | 520 |
| 528 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ | 521 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_ |
| OLD | NEW |