| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
| 8 // For GdkScreen | 8 // For GdkScreen |
| 9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
| 10 #endif // defined(OS_CHROMEOS) | 10 #endif // defined(OS_CHROMEOS) |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 #if defined(OS_WIN) | 289 #if defined(OS_WIN) |
| 290 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), | 290 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), |
| 291 #endif | 291 #endif |
| 292 last_javascript_message_dismissal_(), | 292 last_javascript_message_dismissal_(), |
| 293 suppress_javascript_messages_(false), | 293 suppress_javascript_messages_(false), |
| 294 is_showing_before_unload_dialog_(false), | 294 is_showing_before_unload_dialog_(false), |
| 295 renderer_preferences_(), | 295 renderer_preferences_(), |
| 296 opener_dom_ui_type_(DOMUIFactory::kNoDOMUI), | 296 opener_dom_ui_type_(DOMUIFactory::kNoDOMUI), |
| 297 language_state_(&controller_), | 297 language_state_(&controller_), |
| 298 geolocation_settings_state_(profile), | 298 geolocation_settings_state_(profile), |
| 299 requested_accessibility_tree_(false), |
| 299 closed_by_user_gesture_(false) { | 300 closed_by_user_gesture_(false) { |
| 300 ClearBlockedContentSettings(); | 301 ClearBlockedContentSettings(); |
| 301 renderer_preferences_util::UpdateFromSystemSettings( | 302 renderer_preferences_util::UpdateFromSystemSettings( |
| 302 &renderer_preferences_, profile); | 303 &renderer_preferences_, profile); |
| 303 | 304 |
| 304 #if defined(OS_CHROMEOS) | 305 #if defined(OS_CHROMEOS) |
| 305 // Make sure the thumbnailer is started before starting the render manager. | 306 // Make sure the thumbnailer is started before starting the render manager. |
| 306 // The thumbnailer will want to listen for RVH creations, one of which will | 307 // The thumbnailer will want to listen for RVH creations, one of which will |
| 307 // happen in RVHManager::Init. | 308 // happen in RVHManager::Init. |
| 308 ThumbnailGenerator* generator = g_browser_process->GetThumbnailGenerator(); | 309 ThumbnailGenerator* generator = g_browser_process->GetThumbnailGenerator(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 348 registrar_.Add(this, NotificationType::EXTENSION_LOADED, |
| 348 NotificationService::AllSources()); | 349 NotificationService::AllSources()); |
| 349 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 350 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, |
| 350 NotificationService::AllSources()); | 351 NotificationService::AllSources()); |
| 351 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED, | 352 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED, |
| 352 NotificationService::AllSources()); | 353 NotificationService::AllSources()); |
| 353 | 354 |
| 354 // Set-up the showing of the omnibox search infobar if applicable. | 355 // Set-up the showing of the omnibox search infobar if applicable. |
| 355 if (OmniboxSearchHint::IsEnabled(profile)) | 356 if (OmniboxSearchHint::IsEnabled(profile)) |
| 356 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 357 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
| 358 |
| 359 renderer_accessible_ = |
| 360 CommandLine::ForCurrentProcess()->HasSwitch( |
| 361 switches::kEnableRendererAccessibility); |
| 357 } | 362 } |
| 358 | 363 |
| 359 TabContents::~TabContents() { | 364 TabContents::~TabContents() { |
| 360 is_being_destroyed_ = true; | 365 is_being_destroyed_ = true; |
| 361 | 366 |
| 362 // We don't want any notifications while we're running our destructor. | 367 // We don't want any notifications while we're running our destructor. |
| 363 registrar_.RemoveAll(); | 368 registrar_.RemoveAll(); |
| 364 | 369 |
| 365 // Unregister the notifications of all observed prefs change. | 370 // Unregister the notifications of all observed prefs change. |
| 366 PrefService* prefs = profile()->GetPrefs(); | 371 PrefService* prefs = profile()->GetPrefs(); |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 details.set_error_code(error_code); | 2140 details.set_error_code(error_code); |
| 2136 | 2141 |
| 2137 NotificationService::current()->Notify( | 2142 NotificationService::current()->Notify( |
| 2138 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 2143 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
| 2139 Source<NavigationController>(&controller_), | 2144 Source<NavigationController>(&controller_), |
| 2140 Details<ProvisionalLoadDetails>(&details)); | 2145 Details<ProvisionalLoadDetails>(&details)); |
| 2141 } | 2146 } |
| 2142 | 2147 |
| 2143 void TabContents::DocumentLoadedInFrame() { | 2148 void TabContents::DocumentLoadedInFrame() { |
| 2144 controller_.DocumentLoadedInFrame(); | 2149 controller_.DocumentLoadedInFrame(); |
| 2145 | 2150 if (renderer_accessible_ && !requested_accessibility_tree_) { |
| 2146 render_view_host()->SetDocumentLoaded(true); | 2151 render_view_host()->RequestAccessibilityTree(); |
| 2152 requested_accessibility_tree_ = true; |
| 2153 } |
| 2147 } | 2154 } |
| 2148 | 2155 |
| 2149 void TabContents::OnContentBlocked(ContentSettingsType type) { | 2156 void TabContents::OnContentBlocked(ContentSettingsType type) { |
| 2150 // TODO(joth): remove once fully implemented. | 2157 // TODO(joth): remove once fully implemented. |
| 2151 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION); | 2158 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION); |
| 2152 content_blocked_[type] = true; | 2159 content_blocked_[type] = true; |
| 2153 if (delegate_) | 2160 if (delegate_) |
| 2154 delegate_->OnContentSettingsChange(this); | 2161 delegate_->OnContentSettingsChange(this); |
| 2155 } | 2162 } |
| 2156 | 2163 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2306 NotificationType::RENDER_VIEW_HOST_DELETED, | 2313 NotificationType::RENDER_VIEW_HOST_DELETED, |
| 2307 Source<TabContents>(this), | 2314 Source<TabContents>(this), |
| 2308 Details<RenderViewHost>(rvh)); | 2315 Details<RenderViewHost>(rvh)); |
| 2309 render_manager_.RenderViewDeleted(rvh); | 2316 render_manager_.RenderViewDeleted(rvh); |
| 2310 } | 2317 } |
| 2311 | 2318 |
| 2312 void TabContents::DidNavigate(RenderViewHost* rvh, | 2319 void TabContents::DidNavigate(RenderViewHost* rvh, |
| 2313 const ViewHostMsg_FrameNavigate_Params& params) { | 2320 const ViewHostMsg_FrameNavigate_Params& params) { |
| 2314 int extra_invalidate_flags = 0; | 2321 int extra_invalidate_flags = 0; |
| 2315 | 2322 |
| 2316 render_view_host()->SetDocumentLoaded(false); | 2323 requested_accessibility_tree_ = false; |
| 2317 | 2324 |
| 2318 if (PageTransition::IsMainFrame(params.transition)) { | 2325 if (PageTransition::IsMainFrame(params.transition)) { |
| 2319 bool was_bookmark_bar_visible = ShouldShowBookmarkBar(); | 2326 bool was_bookmark_bar_visible = ShouldShowBookmarkBar(); |
| 2320 bool was_extension_shelf_visible = IsExtensionShelfAlwaysVisible(); | 2327 bool was_extension_shelf_visible = IsExtensionShelfAlwaysVisible(); |
| 2321 | 2328 |
| 2322 render_manager_.DidNavigateMainFrame(rvh); | 2329 render_manager_.DidNavigateMainFrame(rvh); |
| 2323 | 2330 |
| 2324 if (was_bookmark_bar_visible != ShouldShowBookmarkBar()) | 2331 if (was_bookmark_bar_visible != ShouldShowBookmarkBar()) |
| 2325 extra_invalidate_flags |= INVALIDATE_BOOKMARK_BAR; | 2332 extra_invalidate_flags |= INVALIDATE_BOOKMARK_BAR; |
| 2326 if (was_extension_shelf_visible != IsExtensionShelfAlwaysVisible()) | 2333 if (was_extension_shelf_visible != IsExtensionShelfAlwaysVisible()) |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3202 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); | 3209 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); |
| 3203 } | 3210 } |
| 3204 | 3211 |
| 3205 Profile* TabContents::GetProfileForPasswordManager() { | 3212 Profile* TabContents::GetProfileForPasswordManager() { |
| 3206 return profile(); | 3213 return profile(); |
| 3207 } | 3214 } |
| 3208 | 3215 |
| 3209 bool TabContents::DidLastPageLoadEncounterSSLErrors() { | 3216 bool TabContents::DidLastPageLoadEncounterSSLErrors() { |
| 3210 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); | 3217 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); |
| 3211 } | 3218 } |
| OLD | NEW |