core_tab_helper.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ 6#define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ 7 8#include "content/public/browser/web_contents_observer.h" 9#include "content/public/browser/web_contents_user_data.h" 10 11class CoreTabHelperDelegate; 12 13// Per-tab class to handle functionality that is core to the operation of tabs. 14class CoreTabHelper : public content::WebContentsObserver, 15 public content::WebContentsUserData<CoreTabHelper> { 16 public: 17 virtual ~CoreTabHelper(); 18 19 CoreTabHelperDelegate* delegate() const { return delegate_; } 20 void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; } 21 22 // Initial title assigned to NavigationEntries from Navigate. 23 static string16 GetDefaultTitle(); 24 25 // Returns a human-readable description the tab's loading state. 26 string16 GetStatusText() const; 27 28 private: 29 explicit CoreTabHelper(content::WebContents* web_contents); 30 friend class content::WebContentsUserData<CoreTabHelper>; 31 32 // content::WebContentsObserver overrides: 33 virtual void WasShown() OVERRIDE; 34 35 // Delegate for notifying our owner about stuff. Not owned by us. 36 CoreTabHelperDelegate* delegate_; 37 38 DISALLOW_COPY_AND_ASSIGN(CoreTabHelper); 39}; 40 41#endif // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ 42