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 CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/prefs/pref_change_registrar.h" | |
10 #include "content/browser/tab_contents/tab_contents_observer.h" | 9 #include "content/browser/tab_contents/tab_contents_observer.h" |
11 | 10 |
12 class CoreTabHelperDelegate; | 11 class CoreTabHelperDelegate; |
13 class TabContentsWrapper; | 12 class TabContentsWrapper; |
14 | 13 |
15 // Per-tab class to handle functionality that is core to the operation of tabs. | 14 // Per-tab class to handle functionality that is core to the operation of tabs. |
16 class CoreTabHelper : public TabContentsObserver, | 15 class CoreTabHelper : public TabContentsObserver { |
17 public content::NotificationObserver { | |
18 public: | 16 public: |
19 explicit CoreTabHelper(TabContentsWrapper* wrapper); | 17 explicit CoreTabHelper(TabContentsWrapper* wrapper); |
20 virtual ~CoreTabHelper(); | 18 virtual ~CoreTabHelper(); |
21 | 19 |
22 CoreTabHelperDelegate* delegate() const { return delegate_; } | 20 CoreTabHelperDelegate* delegate() const { return delegate_; } |
23 void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; } | 21 void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; } |
24 | 22 |
25 // Initial title assigned to NavigationEntries from Navigate. | 23 // Initial title assigned to NavigationEntries from Navigate. |
26 static string16 GetDefaultTitle(); | 24 static string16 GetDefaultTitle(); |
27 | 25 |
28 // Returns a human-readable description the tab's loading state. | 26 // Returns a human-readable description the tab's loading state. |
29 string16 GetStatusText() const; | 27 string16 GetStatusText() const; |
30 | 28 |
31 private: | 29 private: |
32 // TabContentsObserver overrides: | 30 // TabContentsObserver overrides: |
33 virtual void DidBecomeSelected() OVERRIDE; | 31 virtual void DidBecomeSelected() OVERRIDE; |
34 | 32 |
35 // content::NotificationObserver overrides: | |
36 virtual void Observe(int type, | |
37 const content::NotificationSource& source, | |
38 const content::NotificationDetails& details) OVERRIDE; | |
39 | |
40 // Delegate for notifying our owner about stuff. Not owned by us. | 33 // Delegate for notifying our owner about stuff. Not owned by us. |
41 CoreTabHelperDelegate* delegate_; | 34 CoreTabHelperDelegate* delegate_; |
42 | 35 |
43 // Our owning TabContentsWrapper. | 36 // Our owning TabContentsWrapper. |
44 TabContentsWrapper* wrapper_; | 37 TabContentsWrapper* wrapper_; |
45 | 38 |
46 PrefChangeRegistrar pref_change_registrar_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(CoreTabHelper); | 39 DISALLOW_COPY_AND_ASSIGN(CoreTabHelper); |
49 }; | 40 }; |
50 | 41 |
51 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ | 42 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ |
OLD | NEW |