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

Side by Side Diff: chrome/browser/ui/tab_contents/tab_contents.cc

Issue 10540064: Shorter name. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/tab_contents/tab_contents.h" 5 #include "chrome/browser/ui/tab_contents/tab_contents.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "chrome/browser/autocomplete_history_manager.h" 9 #include "chrome/browser/autocomplete_history_manager.h"
10 #include "chrome/browser/autofill/autofill_external_delegate.h" 10 #include "chrome/browser/autofill/autofill_external_delegate.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // TODO(avi): Can we generalize this so that knowledge of the functionings of 201 // TODO(avi): Can we generalize this so that knowledge of the functionings of
202 // the tab helpers isn't required here? 202 // the tab helpers isn't required here?
203 new_tab_contents->extension_tab_helper()->CopyStateFrom( 203 new_tab_contents->extension_tab_helper()->CopyStateFrom(
204 *extension_tab_helper_.get()); 204 *extension_tab_helper_.get());
205 return new_tab_contents; 205 return new_tab_contents;
206 } 206 }
207 207
208 // static deprecated 208 // static deprecated
209 TabContents* TabContents::GetCurrentWrapperForContents( 209 TabContents* TabContents::GetCurrentWrapperForContents(
210 WebContents* contents) { 210 WebContents* contents) {
211 return GetOwningTabContentsForWebContents(contents); 211 return FromWebContents(contents);
212 } 212 }
213 213
214 // static deprecated 214 // static deprecated
215 const TabContents* TabContents::GetCurrentWrapperForContents( 215 const TabContents* TabContents::GetCurrentWrapperForContents(
216 const WebContents* contents) { 216 const WebContents* contents) {
217 return GetOwningTabContentsForWebContents(contents); 217 return FromWebContents(contents);
218 }
219
220 // static deprecated
221 TabContents* TabContents::GetOwningTabContentsForWebContents(
222 WebContents* contents) {
223 return FromWebContents(contents);
224 }
225
226 // static deprecated
227 const TabContents* TabContents::GetOwningTabContentsForWebContents(
228 const WebContents* contents) {
229 return FromWebContents(contents);
218 } 230 }
219 231
220 // static 232 // static
221 TabContents* TabContents::GetOwningTabContentsForWebContents( 233 TabContents* TabContents::FromWebContents(WebContents* contents) {
222 WebContents* contents) {
223 TabContents** tab_contents = 234 TabContents** tab_contents =
224 property_accessor()->GetProperty(contents->GetPropertyBag()); 235 property_accessor()->GetProperty(contents->GetPropertyBag());
225 236
226 return tab_contents ? *tab_contents : NULL; 237 return tab_contents ? *tab_contents : NULL;
227 } 238 }
228 239
229 // static 240 // static
230 const TabContents* TabContents::GetOwningTabContentsForWebContents( 241 const TabContents* TabContents::FromWebContents(const WebContents* contents) {
231 const WebContents* contents) {
232 TabContents* const* tab_contents = 242 TabContents* const* tab_contents =
233 property_accessor()->GetProperty(contents->GetPropertyBag()); 243 property_accessor()->GetProperty(contents->GetPropertyBag());
234 244
235 return tab_contents ? *tab_contents : NULL; 245 return tab_contents ? *tab_contents : NULL;
236 } 246 }
237 247
238 WebContents* TabContents::web_contents() const { 248 WebContents* TabContents::web_contents() const {
239 return web_contents_.get(); 249 return web_contents_.get();
240 } 250 }
241 251
242 Profile* TabContents::profile() const { 252 Profile* TabContents::profile() const {
243 return Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 253 return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
244 } 254 }
245 255
246 //////////////////////////////////////////////////////////////////////////////// 256 ////////////////////////////////////////////////////////////////////////////////
247 // WebContentsObserver overrides 257 // WebContentsObserver overrides
248 258
249 void TabContents::WebContentsDestroyed(WebContents* tab) { 259 void TabContents::WebContentsDestroyed(WebContents* tab) {
250 // Destruction of the WebContents should only be done by us from our 260 // Destruction of the WebContents should only be done by us from our
251 // destructor. Otherwise it's very likely we (or one of the helpers we own) 261 // destructor. Otherwise it's very likely we (or one of the helpers we own)
252 // will attempt to access the WebContents and we'll crash. 262 // will attempt to access the WebContents and we'll crash.
253 DCHECK(in_destructor_); 263 DCHECK(in_destructor_);
254 } 264 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698