Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(843)

Unified Diff: chrome/browser/ui/tab_contents/tab_contents.cc

Issue 10542010: TabContentsWrapper -> TabContents, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 305df3d18d0bc02c0554108a392d63d4a3020893..557674ec5fa19affc26440292540bfa063da6f18 100644
--- a/chrome/browser/ui/tab_contents/tab_contents.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents.cc
@@ -61,7 +61,7 @@ using content::WebContents;
namespace {
static base::LazyInstance<base::PropertyAccessor<TabContents*> >
- g_tab_contents_wrapper_property_accessor = LAZY_INSTANCE_INITIALIZER;
+ g_tab_contents_property_accessor = LAZY_INSTANCE_INITIALIZER;
} // namespace
@@ -73,7 +73,7 @@ TabContents::TabContents(WebContents* contents)
in_destructor_(false),
web_contents_(contents) {
DCHECK(contents);
- DCHECK(!GetCurrentWrapperForContents(contents));
+ DCHECK(!GetOwningContentsForWebContents(contents));
chrome::SetViewType(contents, chrome::VIEW_TYPE_TAB_CONTENTS);
@@ -191,36 +191,48 @@ TabContents::~TabContents() {
}
base::PropertyAccessor<TabContents*>* TabContents::property_accessor() {
- return g_tab_contents_wrapper_property_accessor.Pointer();
+ return g_tab_contents_property_accessor.Pointer();
}
TabContents* TabContents::Clone() {
- WebContents* new_contents = web_contents()->Clone();
- TabContents* new_wrapper = new TabContents(new_contents);
+ WebContents* new_web_contents = web_contents()->Clone();
+ TabContents* new_tab_contents = new TabContents(new_web_contents);
// TODO(avi): Can we generalize this so that knowledge of the functionings of
// the tab helpers isn't required here?
- new_wrapper->extension_tab_helper()->CopyStateFrom(
+ new_tab_contents->extension_tab_helper()->CopyStateFrom(
*extension_tab_helper_.get());
- return new_wrapper;
+ return new_tab_contents;
}
-// static
+// static deprecated
TabContents* TabContents::GetCurrentWrapperForContents(
WebContents* contents) {
- TabContents** wrapper =
+ return GetOwningContentsForWebContents(contents);
+}
+
+// static deprecated
+const TabContents* TabContents::GetCurrentWrapperForContents(
+ const WebContents* contents) {
+ return GetOwningContentsForWebContents(contents);
+}
+
+// static
+TabContents* TabContents::GetOwningContentsForWebContents(
+ WebContents* contents) {
+ TabContents** tab_contents =
property_accessor()->GetProperty(contents->GetPropertyBag());
- return wrapper ? *wrapper : NULL;
+ return tab_contents ? *tab_contents : NULL;
}
// static
-const TabContents* TabContents::GetCurrentWrapperForContents(
+const TabContents* TabContents::GetOwningContentsForWebContents(
const WebContents* contents) {
- TabContents* const* wrapper =
+ TabContents* const* tab_contents =
property_accessor()->GetProperty(contents->GetPropertyBag());
- return wrapper ? *wrapper : NULL;
+ return tab_contents ? *tab_contents : NULL;
}
WebContents* TabContents::web_contents() const {

Powered by Google App Engine
This is Rietveld 408576698