OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/observer_list.h" | |
17 #include "base/string16.h" | 16 #include "base/string16.h" |
18 #include "content/browser/javascript_dialogs.h" | 17 #include "content/browser/javascript_dialogs.h" |
19 #include "content/browser/renderer_host/render_view_host_delegate.h" | 18 #include "content/browser/renderer_host/render_view_host_delegate.h" |
20 #include "content/browser/tab_contents/constrained_window.h" | 19 #include "content/browser/tab_contents/constrained_window.h" |
21 #include "content/browser/tab_contents/navigation_controller.h" | 20 #include "content/browser/tab_contents/navigation_controller.h" |
22 #include "content/browser/tab_contents/navigation_entry.h" | 21 #include "content/browser/tab_contents/navigation_entry.h" |
23 #include "content/browser/tab_contents/page_navigator.h" | 22 #include "content/browser/tab_contents/page_navigator.h" |
24 #include "content/browser/tab_contents/render_view_host_manager.h" | 23 #include "content/browser/tab_contents/render_view_host_manager.h" |
25 #include "content/browser/tab_contents/tab_contents_observer.h" | 24 #include "content/browser/tab_contents/tab_contents_observer.h" |
26 #include "content/browser/webui/web_ui.h" | 25 #include "content/browser/webui/web_ui.h" |
27 #include "content/common/notification_registrar.h" | 26 #include "content/common/notification_registrar.h" |
28 #include "content/common/property_bag.h" | 27 #include "content/common/property_bag.h" |
29 #include "content/common/renderer_preferences.h" | 28 #include "content/common/renderer_preferences.h" |
30 #include "net/base/load_states.h" | 29 #include "net/base/load_states.h" |
| 30 #include "net/base/network_change_notifier.h" |
31 #include "ui/gfx/native_widget_types.h" | 31 #include "ui/gfx/native_widget_types.h" |
32 | 32 |
33 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
34 #include "base/win/scoped_handle.h" | 34 #include "base/win/scoped_handle.h" |
35 #endif | 35 #endif |
36 | 36 |
37 namespace gfx { | 37 namespace gfx { |
38 class Rect; | 38 class Rect; |
39 } | 39 } |
40 | 40 |
(...skipping 13 matching lines...) Expand all Loading... |
54 struct ViewHostMsg_FrameNavigate_Params; | 54 struct ViewHostMsg_FrameNavigate_Params; |
55 struct WebPreferences; | 55 struct WebPreferences; |
56 class WebUI; | 56 class WebUI; |
57 | 57 |
58 // Describes what goes in the main content area of a tab. TabContents is | 58 // Describes what goes in the main content area of a tab. TabContents is |
59 // the only type of TabContents, and these should be merged together. | 59 // the only type of TabContents, and these should be merged together. |
60 class TabContents : public PageNavigator, | 60 class TabContents : public PageNavigator, |
61 public NotificationObserver, | 61 public NotificationObserver, |
62 public RenderViewHostDelegate, | 62 public RenderViewHostDelegate, |
63 public RenderViewHostManager::Delegate, | 63 public RenderViewHostManager::Delegate, |
64 public content::JavaScriptDialogDelegate { | 64 public content::JavaScriptDialogDelegate, |
| 65 public net::NetworkChangeNotifier::OnlineStateObserver { |
65 public: | 66 public: |
66 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it | 67 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it |
67 // what has changed. Combine them to update more than one thing. | 68 // what has changed. Combine them to update more than one thing. |
68 enum InvalidateTypes { | 69 enum InvalidateTypes { |
69 INVALIDATE_URL = 1 << 0, // The URL has changed. | 70 INVALIDATE_URL = 1 << 0, // The URL has changed. |
70 INVALIDATE_TAB = 1 << 1, // The favicon, app icon, or crashed | 71 INVALIDATE_TAB = 1 << 1, // The favicon, app icon, or crashed |
71 // state changed. | 72 // state changed. |
72 INVALIDATE_LOAD = 1 << 2, // The loading state has changed. | 73 INVALIDATE_LOAD = 1 << 2, // The loading state has changed. |
73 INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed. | 74 INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed. |
74 INVALIDATE_TITLE = 1 << 4, // The title changed. | 75 INVALIDATE_TITLE = 1 << 4, // The title changed. |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 #elif defined(TOOLKIT_USES_GTK) | 508 #elif defined(TOOLKIT_USES_GTK) |
508 friend class TabContentsViewGtk; | 509 friend class TabContentsViewGtk; |
509 #endif | 510 #endif |
510 | 511 |
511 // So InterstitialPage can access SetIsLoading. | 512 // So InterstitialPage can access SetIsLoading. |
512 friend class InterstitialPage; | 513 friend class InterstitialPage; |
513 | 514 |
514 // TODO(brettw) TestTabContents shouldn't exist! | 515 // TODO(brettw) TestTabContents shouldn't exist! |
515 friend class TestTabContents; | 516 friend class TestTabContents; |
516 | 517 |
| 518 // Add all the TabContentObservers. |
| 519 void AddObservers(); |
| 520 |
517 // Message handlers. | 521 // Message handlers. |
518 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | 522 void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
519 bool main_frame, | 523 bool main_frame, |
520 bool has_opener_set, | 524 bool has_opener_set, |
521 const GURL& url); | 525 const GURL& url); |
522 void OnDidRedirectProvisionalLoad(int32 page_id, | 526 void OnDidRedirectProvisionalLoad(int32 page_id, |
523 bool has_opener_set, | 527 bool has_opener_set, |
524 const GURL& source_url, | 528 const GURL& source_url, |
525 const GURL& target_url); | 529 const GURL& target_url); |
526 void OnDidFailProvisionalLoadWithError(int64 frame_id, | 530 void OnDidFailProvisionalLoadWithError(int64 frame_id, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 // InitWithExistingID. | 697 // InitWithExistingID. |
694 virtual bool CreateRenderViewForRenderManager( | 698 virtual bool CreateRenderViewForRenderManager( |
695 RenderViewHost* render_view_host); | 699 RenderViewHost* render_view_host); |
696 | 700 |
697 // NotificationObserver ------------------------------------------------------ | 701 // NotificationObserver ------------------------------------------------------ |
698 | 702 |
699 virtual void Observe(NotificationType type, | 703 virtual void Observe(NotificationType type, |
700 const NotificationSource& source, | 704 const NotificationSource& source, |
701 const NotificationDetails& details); | 705 const NotificationDetails& details); |
702 | 706 |
| 707 // NetworkChangeNotifier::OnlineStateObserver: |
| 708 virtual void OnOnlineStateChanged(bool online); |
| 709 |
703 // Adds the given window to the list of child windows. The window will notify | 710 // Adds the given window to the list of child windows. The window will notify |
704 // via WillClose() when it is being destroyed. | 711 // via WillClose() when it is being destroyed. |
705 void AddConstrainedDialog(ConstrainedWindow* window); | 712 void AddConstrainedDialog(ConstrainedWindow* window); |
706 | 713 |
707 // Stores random bits of data for others to associate with this object. | 714 // Stores random bits of data for others to associate with this object. |
708 // WARNING: this needs to be deleted after NavigationController. | 715 // WARNING: this needs to be deleted after NavigationController. |
709 PropertyBag property_bag_; | 716 PropertyBag property_bag_; |
710 | 717 |
711 // Data for core operation --------------------------------------------------- | 718 // Data for core operation --------------------------------------------------- |
712 | 719 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 ObserverList<TabContentsObserver> observers_; | 835 ObserverList<TabContentsObserver> observers_; |
829 | 836 |
830 // Content restrictions, used to disable print/copy etc based on content's | 837 // Content restrictions, used to disable print/copy etc based on content's |
831 // (full-page plugins for now only) permissions. | 838 // (full-page plugins for now only) permissions. |
832 int content_restrictions_; | 839 int content_restrictions_; |
833 | 840 |
834 DISALLOW_COPY_AND_ASSIGN(TabContents); | 841 DISALLOW_COPY_AND_ASSIGN(TabContents); |
835 }; | 842 }; |
836 | 843 |
837 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 844 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
OLD | NEW |