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

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: rebase, rename 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..7c2326a004ae5a909441f8a5babb369f8b1fc10b 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(!GetOwningTabContentsForWebContents(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 GetOwningTabContentsForWebContents(contents);
+}
+
+// static deprecated
+const TabContents* TabContents::GetCurrentWrapperForContents(
+ const WebContents* contents) {
+ return GetOwningTabContentsForWebContents(contents);
+}
+
+// static
+TabContents* TabContents::GetOwningTabContentsForWebContents(
+ 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::GetOwningTabContentsForWebContents(
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 {
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.h ('k') | chrome/browser/ui/tab_contents/tab_contents_iterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698