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" |
16 #include "base/string16.h" | 17 #include "base/string16.h" |
17 #include "content/browser/javascript_dialogs.h" | 18 #include "content/browser/javascript_dialogs.h" |
18 #include "content/browser/renderer_host/render_view_host_delegate.h" | 19 #include "content/browser/renderer_host/render_view_host_delegate.h" |
19 #include "content/browser/tab_contents/constrained_window.h" | 20 #include "content/browser/tab_contents/constrained_window.h" |
20 #include "content/browser/tab_contents/navigation_controller.h" | 21 #include "content/browser/tab_contents/navigation_controller.h" |
21 #include "content/browser/tab_contents/navigation_entry.h" | 22 #include "content/browser/tab_contents/navigation_entry.h" |
22 #include "content/browser/tab_contents/page_navigator.h" | 23 #include "content/browser/tab_contents/page_navigator.h" |
23 #include "content/browser/tab_contents/render_view_host_manager.h" | 24 #include "content/browser/tab_contents/render_view_host_manager.h" |
24 #include "content/browser/tab_contents/tab_contents_observer.h" | 25 #include "content/browser/tab_contents/tab_contents_observer.h" |
25 #include "content/browser/webui/web_ui.h" | 26 #include "content/browser/webui/web_ui.h" |
26 #include "content/common/notification_registrar.h" | 27 #include "content/common/notification_registrar.h" |
27 #include "content/common/property_bag.h" | 28 #include "content/common/property_bag.h" |
28 #include "content/common/renderer_preferences.h" | 29 #include "content/common/renderer_preferences.h" |
29 #include "net/base/load_states.h" | 30 #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 { | |
66 public: | 65 public: |
67 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it | 66 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it |
68 // what has changed. Combine them to update more than one thing. | 67 // what has changed. Combine them to update more than one thing. |
69 enum InvalidateTypes { | 68 enum InvalidateTypes { |
70 INVALIDATE_URL = 1 << 0, // The URL has changed. | 69 INVALIDATE_URL = 1 << 0, // The URL has changed. |
71 INVALIDATE_TAB = 1 << 1, // The favicon, app icon, or crashed | 70 INVALIDATE_TAB = 1 << 1, // The favicon, app icon, or crashed |
72 // state changed. | 71 // state changed. |
73 INVALIDATE_LOAD = 1 << 2, // The loading state has changed. | 72 INVALIDATE_LOAD = 1 << 2, // The loading state has changed. |
74 INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed. | 73 INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed. |
75 INVALIDATE_TITLE = 1 << 4, // The title changed. | 74 INVALIDATE_TITLE = 1 << 4, // The title changed. |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 #elif defined(TOOLKIT_USES_GTK) | 518 #elif defined(TOOLKIT_USES_GTK) |
520 friend class TabContentsViewGtk; | 519 friend class TabContentsViewGtk; |
521 #endif | 520 #endif |
522 | 521 |
523 // So InterstitialPage can access SetIsLoading. | 522 // So InterstitialPage can access SetIsLoading. |
524 friend class InterstitialPage; | 523 friend class InterstitialPage; |
525 | 524 |
526 // TODO(brettw) TestTabContents shouldn't exist! | 525 // TODO(brettw) TestTabContents shouldn't exist! |
527 friend class TestTabContents; | 526 friend class TestTabContents; |
528 | 527 |
529 // Add all the TabContentObservers. | |
530 void AddObservers(); | |
531 | |
532 // Message handlers. | 528 // Message handlers. |
533 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | 529 void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
534 bool main_frame, | 530 bool main_frame, |
535 bool has_opener_set, | 531 bool has_opener_set, |
536 const GURL& url); | 532 const GURL& url); |
537 void OnDidRedirectProvisionalLoad(int32 page_id, | 533 void OnDidRedirectProvisionalLoad(int32 page_id, |
538 bool has_opener_set, | 534 bool has_opener_set, |
539 const GURL& source_url, | 535 const GURL& source_url, |
540 const GURL& target_url); | 536 const GURL& target_url); |
541 void OnDidFailProvisionalLoadWithError(int64 frame_id, | 537 void OnDidFailProvisionalLoadWithError(int64 frame_id, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 // InitWithExistingID. | 705 // InitWithExistingID. |
710 virtual bool CreateRenderViewForRenderManager( | 706 virtual bool CreateRenderViewForRenderManager( |
711 RenderViewHost* render_view_host); | 707 RenderViewHost* render_view_host); |
712 | 708 |
713 // NotificationObserver ------------------------------------------------------ | 709 // NotificationObserver ------------------------------------------------------ |
714 | 710 |
715 virtual void Observe(NotificationType type, | 711 virtual void Observe(NotificationType type, |
716 const NotificationSource& source, | 712 const NotificationSource& source, |
717 const NotificationDetails& details); | 713 const NotificationDetails& details); |
718 | 714 |
719 // NetworkChangeNotifier::OnlineStateObserver: | |
720 virtual void OnOnlineStateChanged(bool online); | |
721 | |
722 // Adds the given window to the list of child windows. The window will notify | 715 // Adds the given window to the list of child windows. The window will notify |
723 // via WillClose() when it is being destroyed. | 716 // via WillClose() when it is being destroyed. |
724 void AddConstrainedDialog(ConstrainedWindow* window); | 717 void AddConstrainedDialog(ConstrainedWindow* window); |
725 | 718 |
726 // Stores random bits of data for others to associate with this object. | 719 // Stores random bits of data for others to associate with this object. |
727 // WARNING: this needs to be deleted after NavigationController. | 720 // WARNING: this needs to be deleted after NavigationController. |
728 PropertyBag property_bag_; | 721 PropertyBag property_bag_; |
729 | 722 |
730 // Data for core operation --------------------------------------------------- | 723 // Data for core operation --------------------------------------------------- |
731 | 724 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 ObserverList<TabContentsObserver> observers_; | 843 ObserverList<TabContentsObserver> observers_; |
851 | 844 |
852 // Content restrictions, used to disable print/copy etc based on content's | 845 // Content restrictions, used to disable print/copy etc based on content's |
853 // (full-page plugins for now only) permissions. | 846 // (full-page plugins for now only) permissions. |
854 int content_restrictions_; | 847 int content_restrictions_; |
855 | 848 |
856 DISALLOW_COPY_AND_ASSIGN(TabContents); | 849 DISALLOW_COPY_AND_ASSIGN(TabContents); |
857 }; | 850 }; |
858 | 851 |
859 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 852 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
OLD | NEW |