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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 #elif defined(TOOLKIT_USES_GTK) | 517 #elif defined(TOOLKIT_USES_GTK) |
519 friend class TabContentsViewGtk; | 518 friend class TabContentsViewGtk; |
520 #endif | 519 #endif |
521 | 520 |
522 // So InterstitialPage can access SetIsLoading. | 521 // So InterstitialPage can access SetIsLoading. |
523 friend class InterstitialPage; | 522 friend class InterstitialPage; |
524 | 523 |
525 // TODO(brettw) TestTabContents shouldn't exist! | 524 // TODO(brettw) TestTabContents shouldn't exist! |
526 friend class TestTabContents; | 525 friend class TestTabContents; |
527 | 526 |
528 // Add all the TabContentObservers. | |
529 void AddObservers(); | |
530 | |
531 // Message handlers. | 527 // Message handlers. |
532 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | 528 void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
533 bool main_frame, | 529 bool main_frame, |
534 bool has_opener_set, | 530 bool has_opener_set, |
535 const GURL& url); | 531 const GURL& url); |
536 void OnDidRedirectProvisionalLoad(int32 page_id, | 532 void OnDidRedirectProvisionalLoad(int32 page_id, |
537 bool has_opener_set, | 533 bool has_opener_set, |
538 const GURL& source_url, | 534 const GURL& source_url, |
539 const GURL& target_url); | 535 const GURL& target_url); |
540 void OnDidFailProvisionalLoadWithError(int64 frame_id, | 536 void OnDidFailProvisionalLoadWithError(int64 frame_id, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 // InitWithExistingID. | 703 // InitWithExistingID. |
708 virtual bool CreateRenderViewForRenderManager( | 704 virtual bool CreateRenderViewForRenderManager( |
709 RenderViewHost* render_view_host); | 705 RenderViewHost* render_view_host); |
710 | 706 |
711 // NotificationObserver ------------------------------------------------------ | 707 // NotificationObserver ------------------------------------------------------ |
712 | 708 |
713 virtual void Observe(NotificationType type, | 709 virtual void Observe(NotificationType type, |
714 const NotificationSource& source, | 710 const NotificationSource& source, |
715 const NotificationDetails& details); | 711 const NotificationDetails& details); |
716 | 712 |
717 // NetworkChangeNotifier::OnlineStateObserver: | |
718 virtual void OnOnlineStateChanged(bool online); | |
719 | |
720 // Adds the given window to the list of child windows. The window will notify | 713 // Adds the given window to the list of child windows. The window will notify |
721 // via WillClose() when it is being destroyed. | 714 // via WillClose() when it is being destroyed. |
722 void AddConstrainedDialog(ConstrainedWindow* window); | 715 void AddConstrainedDialog(ConstrainedWindow* window); |
723 | 716 |
724 // Stores random bits of data for others to associate with this object. | 717 // Stores random bits of data for others to associate with this object. |
725 // WARNING: this needs to be deleted after NavigationController. | 718 // WARNING: this needs to be deleted after NavigationController. |
726 PropertyBag property_bag_; | 719 PropertyBag property_bag_; |
727 | 720 |
728 // Data for core operation --------------------------------------------------- | 721 // Data for core operation --------------------------------------------------- |
729 | 722 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 ObserverList<TabContentsObserver> observers_; | 841 ObserverList<TabContentsObserver> observers_; |
849 | 842 |
850 // Content restrictions, used to disable print/copy etc based on content's | 843 // Content restrictions, used to disable print/copy etc based on content's |
851 // (full-page plugins for now only) permissions. | 844 // (full-page plugins for now only) permissions. |
852 int content_restrictions_; | 845 int content_restrictions_; |
853 | 846 |
854 DISALLOW_COPY_AND_ASSIGN(TabContents); | 847 DISALLOW_COPY_AND_ASSIGN(TabContents); |
855 }; | 848 }; |
856 | 849 |
857 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 850 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
OLD | NEW |