summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/tab_contents
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-17 03:09:42 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-17 03:09:42 +0000
commitb5a1d11cc70ab12c69e579d132204863a780eb75 (patch)
treea9300148dd2434b645ad7fe1716cce2f9e42e064 /chrome/browser/ui/tab_contents
parentcd124097edce07ef5e0a7f80105e81c7982b81a1 (diff)
downloadchromium_src-b5a1d11cc70ab12c69e579d132204863a780eb75.zip
chromium_src-b5a1d11cc70ab12c69e579d132204863a780eb75.tar.gz
chromium_src-b5a1d11cc70ab12c69e579d132204863a780eb75.tar.bz2
Make TabContentsObserver handle registration automatically, as well as exposing getters for TC, routing_id, and sending messages.
Review URL: http://codereview.chromium.org/6537004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/tab_contents')
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.cc20
1 files changed, 5 insertions, 15 deletions
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index 3e6a9da..d1d46bfd 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -22,7 +22,8 @@ static base::LazyInstance<PropertyAccessor<TabContentsWrapper*> >
// TabContentsWrapper, public:
TabContentsWrapper::TabContentsWrapper(TabContents* contents)
- : delegate_(NULL),
+ : TabContentsObserver(contents),
+ delegate_(NULL),
is_starred_(false),
tab_contents_(contents) {
DCHECK(contents);
@@ -30,17 +31,12 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents)
// go to a Browser.
property_accessor()->SetProperty(contents->property_bag(), this);
- tab_contents()->AddObserver(this);
-
// Create the tab helpers.
- find_tab_helper_.reset(new FindTabHelper(this));
- tab_contents()->AddObserver(find_tab_helper_.get());
+ find_tab_helper_.reset(new FindTabHelper(contents));
password_manager_delegate_.reset(new PasswordManagerDelegateImpl(contents));
password_manager_.reset(
- new PasswordManager(password_manager_delegate_.get()));
- tab_contents()->AddObserver(password_manager_.get());
- search_engine_tab_helper_.reset(new SearchEngineTabHelper(this));
- tab_contents()->AddObserver(search_engine_tab_helper_.get());
+ new PasswordManager(contents, password_manager_delegate_.get()));
+ search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents));
// Register for notifications about URL starredness changing on any profile.
registrar_.Add(this, NotificationType::URLS_STARRED,
@@ -52,12 +48,6 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents)
TabContentsWrapper::~TabContentsWrapper() {
// We don't want any notifications while we're running our destructor.
registrar_.RemoveAll();
-
- // Unregister observers.
- tab_contents()->RemoveObserver(this);
- tab_contents()->RemoveObserver(find_tab_helper_.get());
- tab_contents()->RemoveObserver(password_manager_.get());
- tab_contents()->RemoveObserver(search_engine_tab_helper_.get());
}
PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() {