| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Web progress notifier implementation. | 5 // Web progress notifier implementation. |
| 6 #ifndef CEEE_IE_PLUGIN_BHO_WEB_PROGRESS_NOTIFIER_H_ | 6 #ifndef CEEE_IE_PLUGIN_BHO_WEB_PROGRESS_NOTIFIER_H_ |
| 7 #define CEEE_IE_PLUGIN_BHO_WEB_PROGRESS_NOTIFIER_H_ | 7 #define CEEE_IE_PLUGIN_BHO_WEB_PROGRESS_NOTIFIER_H_ |
| 8 | 8 |
| 9 #include <atlbase.h> | 9 #include <atlbase.h> |
| 10 #include <tlogstg.h> | 10 #include <tlogstg.h> |
| 11 | 11 |
| 12 #include <map> | 12 #include <map> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "ceee/ie/plugin/bho/web_browser_events_source.h" | 16 #include "ceee/ie/plugin/bho/web_browser_events_source.h" |
| 17 #include "ceee/ie/plugin/bho/webnavigation_events_funnel.h" | |
| 18 #include "ceee/ie/plugin/bho/webrequest_notifier.h" | 17 #include "ceee/ie/plugin/bho/webrequest_notifier.h" |
| 19 #include "ceee/ie/plugin/bho/window_message_source.h" | 18 #include "ceee/ie/plugin/bho/window_message_source.h" |
| 20 #include "chrome/common/page_transition_types.h" | 19 #include "chrome/common/page_transition_types.h" |
| 21 | 20 |
| 21 class WebNavigationEventsFunnel; |
| 22 |
| 22 // WebProgressNotifier sends to the Broker various Web progress events, | 23 // WebProgressNotifier sends to the Broker various Web progress events, |
| 23 // including Web page navigation events and HTTP request/response events. | 24 // including Web page navigation events and HTTP request/response events. |
| 24 class WebProgressNotifier : public WebBrowserEventsSource::Sink, | 25 class WebProgressNotifier : public WebBrowserEventsSource::Sink, |
| 25 public WindowMessageSource::Sink { | 26 public WindowMessageSource::Sink { |
| 26 public: | 27 public: |
| 27 WebProgressNotifier(); | 28 WebProgressNotifier(); |
| 28 virtual ~WebProgressNotifier(); | 29 virtual ~WebProgressNotifier(); |
| 29 | 30 |
| 30 HRESULT Initialize( | 31 HRESULT Initialize( |
| 31 WebBrowserEventsSource* web_browser_events_source, | 32 WebBrowserEventsSource* web_browser_events_source, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 193 |
| 193 // The transition type for the current navigation in this frame. | 194 // The transition type for the current navigation in this frame. |
| 194 PageTransition::Type transition_type; | 195 PageTransition::Type transition_type; |
| 195 // The transition qualifiers for the current navigation in this frame. | 196 // The transition qualifiers for the current navigation in this frame. |
| 196 TransitionQualifiers transition_qualifiers; | 197 TransitionQualifiers transition_qualifiers; |
| 197 // The frame ID. | 198 // The frame ID. |
| 198 const int frame_id; | 199 const int frame_id; |
| 199 }; | 200 }; |
| 200 | 201 |
| 201 // Accessor so that we can mock it in unit tests. | 202 // Accessor so that we can mock it in unit tests. |
| 202 virtual WebNavigationEventsFunnel& webnavigation_events_funnel() { | 203 virtual WebNavigationEventsFunnel* webnavigation_events_funnel(); |
| 203 return webnavigation_events_funnel_; | |
| 204 } | |
| 205 | 204 |
| 206 // Accessor so that we can mock WebRequestNotifier in unit tests. | 205 // Accessor so that we can mock WebRequestNotifier in unit tests. |
| 207 virtual WebRequestNotifier* webrequest_notifier() { | 206 virtual WebRequestNotifier* webrequest_notifier(); |
| 208 if (cached_webrequest_notifier_ == NULL) { | |
| 209 cached_webrequest_notifier_ = ProductionWebRequestNotifier::get(); | |
| 210 } | |
| 211 return cached_webrequest_notifier_; | |
| 212 } | |
| 213 | 207 |
| 214 // Unit testing seems to create a WindowMessageSource instance. | 208 // Unit testing seems to create a WindowMessageSource instance. |
| 215 virtual WindowMessageSource* CreateWindowMessageSource(); | 209 virtual WindowMessageSource* CreateWindowMessageSource(); |
| 216 | 210 |
| 217 // Whether the current navigation is a navigation among the browsing history | 211 // Whether the current navigation is a navigation among the browsing history |
| 218 // (forward/back list). | 212 // (forward/back list). |
| 219 // The method is made virtual so that we could easily mock it in unit tests. | 213 // The method is made virtual so that we could easily mock it in unit tests. |
| 220 virtual bool IsForwardBack(BSTR url); | 214 virtual bool IsForwardBack(BSTR url); |
| 221 | 215 |
| 222 // Whether we are currently inside the onload event handler of the page. | 216 // Whether we are currently inside the onload event handler of the page. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 bool FilterOutWebBrowserEvent(IWebBrowser2* browser, | 284 bool FilterOutWebBrowserEvent(IWebBrowser2* browser, |
| 291 FilteringInfo::Event event); | 285 FilteringInfo::Event event); |
| 292 | 286 |
| 293 // This class doesn't have ownership of the object that | 287 // This class doesn't have ownership of the object that |
| 294 // web_browser_events_source_ points to. | 288 // web_browser_events_source_ points to. |
| 295 WebBrowserEventsSource* web_browser_events_source_; | 289 WebBrowserEventsSource* web_browser_events_source_; |
| 296 // Publisher of events about Windows message handling. | 290 // Publisher of events about Windows message handling. |
| 297 scoped_ptr<WindowMessageSource> window_message_source_; | 291 scoped_ptr<WindowMessageSource> window_message_source_; |
| 298 | 292 |
| 299 // The funnel for sending webNavigation events to the broker. | 293 // The funnel for sending webNavigation events to the broker. |
| 300 WebNavigationEventsFunnel webnavigation_events_funnel_; | 294 scoped_ptr<WebNavigationEventsFunnel> webnavigation_events_funnel_; |
| 301 | 295 |
| 302 // Information related to the main frame. | 296 // Information related to the main frame. |
| 303 FrameInfo main_frame_info_; | 297 FrameInfo main_frame_info_; |
| 304 | 298 |
| 305 // IWebBrowser2 interface pointer of the main frame. | 299 // IWebBrowser2 interface pointer of the main frame. |
| 306 CComPtr<IWebBrowser2> main_browser_; | 300 CComPtr<IWebBrowser2> main_browser_; |
| 307 // ITravelLogStg interface pointer to manage the forward/back list. | 301 // ITravelLogStg interface pointer to manage the forward/back list. |
| 308 CComPtr<ITravelLogStg> travel_log_; | 302 CComPtr<ITravelLogStg> travel_log_; |
| 309 // Window handle of the tab. | 303 // Window handle of the tab. |
| 310 CeeeWindowHandle tab_handle_; | 304 CeeeWindowHandle tab_handle_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 bool webrequest_notifier_initialized_; | 351 bool webrequest_notifier_initialized_; |
| 358 | 352 |
| 359 DWORD create_thread_id_; | 353 DWORD create_thread_id_; |
| 360 | 354 |
| 361 FilteringInfo filtering_info_; | 355 FilteringInfo filtering_info_; |
| 362 private: | 356 private: |
| 363 DISALLOW_COPY_AND_ASSIGN(WebProgressNotifier); | 357 DISALLOW_COPY_AND_ASSIGN(WebProgressNotifier); |
| 364 }; | 358 }; |
| 365 | 359 |
| 366 #endif // CEEE_IE_PLUGIN_BHO_WEB_PROGRESS_NOTIFIER_H_ | 360 #endif // CEEE_IE_PLUGIN_BHO_WEB_PROGRESS_NOTIFIER_H_ |
| OLD | NEW |