| Index: chrome/browser/ui/tab_contents/tab_contents.cc
|
| diff --git a/chrome/browser/ui/tab_contents/tab_contents.cc b/chrome/browser/ui/tab_contents/tab_contents.cc
|
| index d1fdb6b5f1724039b0d8ca1dc28552c5de3447a6..b905d5f7d379091303603c63feb69cf23e55eb90 100644
|
| --- a/chrome/browser/ui/tab_contents/tab_contents.cc
|
| +++ b/chrome/browser/ui/tab_contents/tab_contents.cc
|
| @@ -64,8 +64,18 @@ using content::WebContents;
|
|
|
| namespace {
|
|
|
| -static base::LazyInstance<base::PropertyAccessor<TabContents*> >
|
| - g_tab_contents_property_accessor = LAZY_INSTANCE_INITIALIZER;
|
| +const char kTabContentsUserDataKey[] = "TabContentsUserData";
|
| +
|
| +class TabContentsUserData : public base::SupportsUserData::Data {
|
| + public:
|
| + explicit TabContentsUserData(TabContents* tab_contents)
|
| + : tab_contents_(tab_contents) {}
|
| + virtual ~TabContentsUserData() {}
|
| + TabContents* tab_contents() { return tab_contents_; }
|
| +
|
| + private:
|
| + TabContents* tab_contents_; // unowned
|
| +};
|
|
|
| } // namespace
|
|
|
| @@ -81,9 +91,9 @@ TabContents::TabContents(WebContents* contents)
|
|
|
| chrome::SetViewType(contents, chrome::VIEW_TYPE_TAB_CONTENTS);
|
|
|
| - // Stash this in the property bag so it can be retrieved without having to
|
| - // go to a Browser.
|
| - property_accessor()->SetProperty(contents->GetPropertyBag(), this);
|
| + // Stash this in the WebContents.
|
| + contents->SetUserData(&kTabContentsUserDataKey,
|
| + new TabContentsUserData(this));
|
|
|
| // Create the tab helpers.
|
| // restore_tab_helper because it sets up the tab ID, and other helpers may
|
| @@ -205,10 +215,6 @@ TabContents::~TabContents() {
|
| infobar_tab_helper_.reset();
|
| }
|
|
|
| -base::PropertyAccessor<TabContents*>* TabContents::property_accessor() {
|
| - return g_tab_contents_property_accessor.Pointer();
|
| -}
|
| -
|
| TabContents* TabContents::Clone() {
|
| WebContents* new_web_contents = web_contents()->Clone();
|
| TabContents* new_tab_contents = new TabContents(new_web_contents);
|
| @@ -222,18 +228,18 @@ TabContents* TabContents::Clone() {
|
|
|
| // static
|
| TabContents* TabContents::FromWebContents(WebContents* contents) {
|
| - TabContents** tab_contents =
|
| - property_accessor()->GetProperty(contents->GetPropertyBag());
|
| + TabContentsUserData* user_data = static_cast<TabContentsUserData*>(
|
| + contents->GetUserData(&kTabContentsUserDataKey));
|
|
|
| - return tab_contents ? *tab_contents : NULL;
|
| + return user_data ? user_data->tab_contents() : NULL;
|
| }
|
|
|
| // static
|
| const TabContents* TabContents::FromWebContents(const WebContents* contents) {
|
| - TabContents* const* tab_contents =
|
| - property_accessor()->GetProperty(contents->GetPropertyBag());
|
| + TabContentsUserData* user_data = static_cast<TabContentsUserData*>(
|
| + contents->GetUserData(&kTabContentsUserDataKey));
|
|
|
| - return tab_contents ? *tab_contents : NULL;
|
| + return user_data ? user_data->tab_contents() : NULL;
|
| }
|
|
|
| WebContents* TabContents::web_contents() const {
|
|
|