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

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 11137004: Revert "Revert"Adding a WindowAndroidHelper class" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sky's nit Created 8 years, 2 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/android/tab_android.h ('k') | chrome/browser/android/tab_base_android_impl.h » ('j') | 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/android/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 #include "chrome/browser/ui/android/window_android_helper.h"
6 #include "chrome/browser/ui/tab_contents/tab_contents.h" 7 #include "chrome/browser/ui/tab_contents/tab_contents.h"
7 #include "content/public/browser/android/content_view_core.h" 8 #include "content/public/browser/android/content_view_core.h"
8 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
9 10
10
11 TabContents* TabAndroid::GetOrCreateTabContents( 11 TabContents* TabAndroid::GetOrCreateTabContents(
12 content::WebContents* web_contents) { 12 content::WebContents* web_contents) {
13 TabContents* tab_contents = TabContents::FromWebContents(web_contents); 13 TabContents* tab_contents = TabContents::FromWebContents(web_contents);
14 return tab_contents ? tab_contents : TabContents::Factory::CreateTabContents( 14 if (!tab_contents) {
15 web_contents); 15 tab_contents = TabContents::Factory::CreateTabContents(web_contents);
16 InitTabHelpers(web_contents);
17 }
18 return tab_contents;
19 }
20
21 void TabAndroid::InitTabHelpers(content::WebContents* web_contents) {
22 WindowAndroidHelper::CreateForWebContents(web_contents);
16 } 23 }
17 24
18 TabContents* TabAndroid::InitTabContentsFromView(JNIEnv* env, 25 TabContents* TabAndroid::InitTabContentsFromView(JNIEnv* env,
19 jobject content_view) { 26 jobject content_view) {
20 content::ContentViewCore* content_view_core = 27 content::ContentViewCore* content_view_core =
21 content::ContentViewCore::GetNativeContentViewCore(env, content_view); 28 content::ContentViewCore::GetNativeContentViewCore(env, content_view);
22 DCHECK(content_view_core); 29 DCHECK(content_view_core);
23 DCHECK(content_view_core->GetWebContents()); 30 DCHECK(content_view_core->GetWebContents());
24 return GetOrCreateTabContents(content_view_core->GetWebContents()); 31 return GetOrCreateTabContents(content_view_core->GetWebContents());
25 } 32 }
26 33
27 TabAndroid::TabAndroid() : tab_id_(-1) { 34 TabAndroid::TabAndroid() : tab_id_(-1) {
28 } 35 }
29 36
30 TabAndroid::~TabAndroid() { 37 TabAndroid::~TabAndroid() {
31 } 38 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/android/tab_base_android_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698