OLD | NEW |
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 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" | 9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" |
10 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 10 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 42 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
43 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 43 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
44 #include "components/autofill/content/browser/autofill_driver_impl.h" | 44 #include "components/autofill/content/browser/autofill_driver_impl.h" |
45 #include "content/public/browser/android/content_view_core.h" | 45 #include "content/public/browser/android/content_view_core.h" |
46 #include "content/public/browser/navigation_entry.h" | 46 #include "content/public/browser/navigation_entry.h" |
47 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
49 #include "extensions/browser/view_type_utils.h" | 49 #include "extensions/browser/view_type_utils.h" |
50 #include "jni/TabBase_jni.h" | 50 #include "jni/TabBase_jni.h" |
51 | 51 |
| 52 #if defined(ENABLE_MANAGED_USERS) |
| 53 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" |
| 54 #endif |
| 55 |
52 namespace { | 56 namespace { |
53 | 57 |
54 const char kTabHelpersInitializedUserDataKey[] = | 58 const char kTabHelpersInitializedUserDataKey[] = |
55 "TabAndroidTabHelpersInitialized"; | 59 "TabAndroidTabHelpersInitialized"; |
56 | 60 |
57 } // namespace | 61 } // namespace |
58 | 62 |
59 void BrowserTabContents::AttachTabHelpers(content::WebContents* contents) { | 63 void BrowserTabContents::AttachTabHelpers(content::WebContents* contents) { |
60 // If already initialized, nothing to be done. | 64 // If already initialized, nothing to be done. |
61 base::SupportsUserData::Data* initialization_tag = | 65 base::SupportsUserData::Data* initialization_tag = |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 SingleTabModeTabHelper::CreateForWebContents(contents); | 106 SingleTabModeTabHelper::CreateForWebContents(contents); |
103 SSLTabHelper::CreateForWebContents(contents); | 107 SSLTabHelper::CreateForWebContents(contents); |
104 TabSpecificContentSettings::CreateForWebContents(contents); | 108 TabSpecificContentSettings::CreateForWebContents(contents); |
105 TranslateTabHelper::CreateForWebContents(contents); | 109 TranslateTabHelper::CreateForWebContents(contents); |
106 WindowAndroidHelper::CreateForWebContents(contents); | 110 WindowAndroidHelper::CreateForWebContents(contents); |
107 | 111 |
108 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile(profile)) { | 112 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile(profile)) { |
109 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( | 113 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( |
110 contents); | 114 contents); |
111 } | 115 } |
| 116 |
| 117 #if defined(ENABLE_MANAGED_USERS) |
| 118 if (profile->IsManaged()) |
| 119 ManagedModeNavigationObserver::CreateForWebContents(contents); |
| 120 #endif |
112 } | 121 } |
113 | 122 |
114 // TODO(dtrainor): Refactor so we do not need this method. | 123 // TODO(dtrainor): Refactor so we do not need this method. |
115 void TabAndroid::InitTabHelpers(content::WebContents* contents) { | 124 void TabAndroid::InitTabHelpers(content::WebContents* contents) { |
116 BrowserTabContents::AttachTabHelpers(contents); | 125 BrowserTabContents::AttachTabHelpers(contents); |
117 } | 126 } |
118 | 127 |
119 TabAndroid* TabAndroid::FromWebContents(content::WebContents* web_contents) { | 128 TabAndroid* TabAndroid::FromWebContents(content::WebContents* web_contents) { |
120 CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(web_contents); | 129 CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(web_contents); |
121 if (!core_tab_helper) | 130 if (!core_tab_helper) |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 404 |
396 content::NavigationEntry* entry = | 405 content::NavigationEntry* entry = |
397 web_contents()->GetController().GetVisibleEntry(); | 406 web_contents()->GetController().GetVisibleEntry(); |
398 if (entry && url == entry->GetVirtualURL().spec()) | 407 if (entry && url == entry->GetVirtualURL().spec()) |
399 entry->SetTitle(title); | 408 entry->SetTitle(title); |
400 } | 409 } |
401 | 410 |
402 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 411 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
403 return RegisterNativesImpl(env); | 412 return RegisterNativesImpl(env); |
404 } | 413 } |
OLD | NEW |