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

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

Issue 2014803002: Move DownloadControllerAndroid from content/ to chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved download delegate interface to native Created 4 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "cc/layers/layer.h" 15 #include "cc/layers/layer.h"
16 #include "chrome/browser/android/compositor/tab_content_manager.h" 16 #include "chrome/browser/android/compositor/tab_content_manager.h"
17 #include "chrome/browser/android/download/chrome_download_delegate.h"
17 #include "chrome/browser/android/metrics/uma_utils.h" 18 #include "chrome/browser/android/metrics/uma_utils.h"
18 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 19 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
19 #include "chrome/browser/android/offline_pages/offline_page_utils.h" 20 #include "chrome/browser/android/offline_pages/offline_page_utils.h"
20 #include "chrome/browser/android/tab_web_contents_delegate_android.h" 21 #include "chrome/browser/android/tab_web_contents_delegate_android.h"
21 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 22 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
22 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" 23 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
23 #include "chrome/browser/browser_about_handler.h" 24 #include "chrome/browser/browser_about_handler.h"
24 #include "chrome/browser/chrome_notification_types.h" 25 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 26 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
26 #include "chrome/browser/infobars/infobar_service.h" 27 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 void TabAndroid::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { 373 void TabAndroid::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) {
373 delete this; 374 delete this;
374 } 375 }
375 376
376 void TabAndroid::InitWebContents( 377 void TabAndroid::InitWebContents(
377 JNIEnv* env, 378 JNIEnv* env,
378 const JavaParamRef<jobject>& obj, 379 const JavaParamRef<jobject>& obj,
379 jboolean incognito, 380 jboolean incognito,
380 const JavaParamRef<jobject>& jcontent_view_core, 381 const JavaParamRef<jobject>& jcontent_view_core,
381 const JavaParamRef<jobject>& jweb_contents_delegate, 382 const JavaParamRef<jobject>& jweb_contents_delegate,
383 const JavaParamRef<jobject>& jdownload_delegate,
382 const JavaParamRef<jobject>& jcontext_menu_populator) { 384 const JavaParamRef<jobject>& jcontext_menu_populator) {
383 content::ContentViewCore* content_view_core = 385 content::ContentViewCore* content_view_core =
384 content::ContentViewCore::GetNativeContentViewCore(env, 386 content::ContentViewCore::GetNativeContentViewCore(env,
385 jcontent_view_core); 387 jcontent_view_core);
386 DCHECK(content_view_core); 388 DCHECK(content_view_core);
387 DCHECK(content_view_core->GetWebContents()); 389 DCHECK(content_view_core->GetWebContents());
388 390
389 web_contents_.reset(content_view_core->GetWebContents()); 391 web_contents_.reset(content_view_core->GetWebContents());
390 AttachTabHelpers(web_contents_.get()); 392 AttachTabHelpers(web_contents_.get());
391 393
392 SetWindowSessionID(session_window_id_.id()); 394 SetWindowSessionID(session_window_id_.id());
393 395
394 session_tab_id_.set_id( 396 session_tab_id_.set_id(
395 SessionTabHelper::FromWebContents(web_contents())->session_id().id()); 397 SessionTabHelper::FromWebContents(web_contents())->session_id().id());
396 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( 398 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator(
397 jcontext_menu_populator); 399 jcontext_menu_populator);
398 ViewAndroidHelper::FromWebContents(web_contents())-> 400 ViewAndroidHelper::FromWebContents(web_contents())->
399 SetViewAndroid(content_view_core); 401 SetViewAndroid(content_view_core);
400 CoreTabHelper::FromWebContents(web_contents())->set_delegate(this); 402 CoreTabHelper::FromWebContents(web_contents())->set_delegate(this);
401 SearchTabHelper::FromWebContents(web_contents())->set_delegate(this); 403 SearchTabHelper::FromWebContents(web_contents())->set_delegate(this);
402 web_contents_delegate_.reset( 404 web_contents_delegate_.reset(
403 new chrome::android::TabWebContentsDelegateAndroid( 405 new chrome::android::TabWebContentsDelegateAndroid(
404 env, jweb_contents_delegate)); 406 env, jweb_contents_delegate));
405 web_contents_delegate_->LoadProgressChanged(web_contents(), 0); 407 web_contents_delegate_->LoadProgressChanged(web_contents(), 0);
406 web_contents()->SetDelegate(web_contents_delegate_.get()); 408 web_contents()->SetDelegate(web_contents_delegate_.get());
409 web_contents()->SetDownloadDelegate(
410 new ChromeDownloadDelegate(jdownload_delegate));
no sievers 2016/06/02 23:29:06 Who takes ownership of the new ChromeDownloadDeleg
Jinsuk Kim 2016/06/03 11:04:14 Now ContentViewCoreImpl owns it and has the same l
407 411
408 notification_registrar_.Add( 412 notification_registrar_.Add(
409 this, 413 this,
410 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 414 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
411 content::Source<content::WebContents>(web_contents())); 415 content::Source<content::WebContents>(web_contents()));
412 notification_registrar_.Add( 416 notification_registrar_.Add(
413 this, 417 this,
414 content::NOTIFICATION_NAV_ENTRY_CHANGED, 418 content::NOTIFICATION_NAV_ENTRY_CHANGED,
415 content::Source<content::NavigationController>( 419 content::Source<content::NavigationController>(
416 &web_contents()->GetController())); 420 &web_contents()->GetController()));
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 914 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
911 TRACE_EVENT0("native", "TabAndroid::Init"); 915 TRACE_EVENT0("native", "TabAndroid::Init");
912 // This will automatically bind to the Java object and pass ownership there. 916 // This will automatically bind to the Java object and pass ownership there.
913 new TabAndroid(env, obj); 917 new TabAndroid(env, obj);
914 } 918 }
915 919
916 // static 920 // static
917 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 921 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
918 return RegisterNativesImpl(env); 922 return RegisterNativesImpl(env);
919 } 923 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698