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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 notify_disconnection_(false), | 283 notify_disconnection_(false), |
284 history_requests_(), | 284 history_requests_(), |
285 #if defined(OS_WIN) | 285 #if defined(OS_WIN) |
286 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), | 286 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), |
287 #endif | 287 #endif |
288 last_javascript_message_dismissal_(), | 288 last_javascript_message_dismissal_(), |
289 suppress_javascript_messages_(false), | 289 suppress_javascript_messages_(false), |
290 is_showing_before_unload_dialog_(false), | 290 is_showing_before_unload_dialog_(false), |
291 renderer_preferences_(), | 291 renderer_preferences_(), |
292 opener_dom_ui_type_(DOMUIFactory::kNoDOMUI), | 292 opener_dom_ui_type_(DOMUIFactory::kNoDOMUI), |
293 language_state_(&controller_), | 293 language_state_(&controller_) { |
294 requested_accessibility_tree_(false) { | |
295 ClearBlockedContentSettings(); | 294 ClearBlockedContentSettings(); |
296 renderer_preferences_util::UpdateFromSystemSettings( | 295 renderer_preferences_util::UpdateFromSystemSettings( |
297 &renderer_preferences_, profile); | 296 &renderer_preferences_, profile); |
298 | 297 |
299 #if defined(OS_CHROMEOS) | 298 #if defined(OS_CHROMEOS) |
300 // Make sure the thumbnailer is started before starting the render manager. | 299 // Make sure the thumbnailer is started before starting the render manager. |
301 // The thumbnailer will want to listen for RVH creations, one of which will | 300 // The thumbnailer will want to listen for RVH creations, one of which will |
302 // happen in RVHManager::Init. | 301 // happen in RVHManager::Init. |
303 ThumbnailGenerator* generator = g_browser_process->GetThumbnailGenerator(); | 302 ThumbnailGenerator* generator = g_browser_process->GetThumbnailGenerator(); |
304 if (generator) | 303 if (generator) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 341 registrar_.Add(this, NotificationType::EXTENSION_LOADED, |
343 NotificationService::AllSources()); | 342 NotificationService::AllSources()); |
344 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 343 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, |
345 NotificationService::AllSources()); | 344 NotificationService::AllSources()); |
346 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED, | 345 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED, |
347 NotificationService::AllSources()); | 346 NotificationService::AllSources()); |
348 | 347 |
349 // Set-up the showing of the omnibox search infobar if applicable. | 348 // Set-up the showing of the omnibox search infobar if applicable. |
350 if (OmniboxSearchHint::IsEnabled(profile)) | 349 if (OmniboxSearchHint::IsEnabled(profile)) |
351 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 350 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
352 | |
353 renderer_accessible_ = | |
354 CommandLine::ForCurrentProcess()->HasSwitch( | |
355 switches::kEnableRendererAccessibility); | |
356 } | 351 } |
357 | 352 |
358 TabContents::~TabContents() { | 353 TabContents::~TabContents() { |
359 is_being_destroyed_ = true; | 354 is_being_destroyed_ = true; |
360 | 355 |
361 // We don't want any notifications while we're running our destructor. | 356 // We don't want any notifications while we're running our destructor. |
362 registrar_.RemoveAll(); | 357 registrar_.RemoveAll(); |
363 | 358 |
364 // Unregister the notifications of all observed prefs change. | 359 // Unregister the notifications of all observed prefs change. |
365 PrefService* prefs = profile()->GetPrefs(); | 360 PrefService* prefs = profile()->GetPrefs(); |
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 details.set_error_code(error_code); | 2119 details.set_error_code(error_code); |
2125 | 2120 |
2126 NotificationService::current()->Notify( | 2121 NotificationService::current()->Notify( |
2127 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 2122 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
2128 Source<NavigationController>(&controller_), | 2123 Source<NavigationController>(&controller_), |
2129 Details<ProvisionalLoadDetails>(&details)); | 2124 Details<ProvisionalLoadDetails>(&details)); |
2130 } | 2125 } |
2131 | 2126 |
2132 void TabContents::DocumentLoadedInFrame() { | 2127 void TabContents::DocumentLoadedInFrame() { |
2133 controller_.DocumentLoadedInFrame(); | 2128 controller_.DocumentLoadedInFrame(); |
2134 if (renderer_accessible_ && !requested_accessibility_tree_) { | |
2135 render_view_host()->RequestAccessibilityTree(); | |
2136 requested_accessibility_tree_ = true; | |
2137 } | |
2138 } | 2129 } |
2139 | 2130 |
2140 void TabContents::OnContentBlocked(ContentSettingsType type) { | 2131 void TabContents::OnContentBlocked(ContentSettingsType type) { |
2141 // TODO(joth): remove once fully implemented. | 2132 // TODO(joth): remove once fully implemented. |
2142 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION); | 2133 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION); |
2143 content_blocked_[type] = true; | 2134 content_blocked_[type] = true; |
2144 if (delegate_) | 2135 if (delegate_) |
2145 delegate_->OnContentSettingsChange(this); | 2136 delegate_->OnContentSettingsChange(this); |
2146 } | 2137 } |
2147 | 2138 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2297 NotificationType::RENDER_VIEW_HOST_DELETED, | 2288 NotificationType::RENDER_VIEW_HOST_DELETED, |
2298 Source<TabContents>(this), | 2289 Source<TabContents>(this), |
2299 Details<RenderViewHost>(rvh)); | 2290 Details<RenderViewHost>(rvh)); |
2300 render_manager_.RenderViewDeleted(rvh); | 2291 render_manager_.RenderViewDeleted(rvh); |
2301 } | 2292 } |
2302 | 2293 |
2303 void TabContents::DidNavigate(RenderViewHost* rvh, | 2294 void TabContents::DidNavigate(RenderViewHost* rvh, |
2304 const ViewHostMsg_FrameNavigate_Params& params) { | 2295 const ViewHostMsg_FrameNavigate_Params& params) { |
2305 int extra_invalidate_flags = 0; | 2296 int extra_invalidate_flags = 0; |
2306 | 2297 |
2307 requested_accessibility_tree_ = false; | |
2308 | |
2309 if (PageTransition::IsMainFrame(params.transition)) { | 2298 if (PageTransition::IsMainFrame(params.transition)) { |
2310 bool was_bookmark_bar_visible = ShouldShowBookmarkBar(); | 2299 bool was_bookmark_bar_visible = ShouldShowBookmarkBar(); |
2311 bool was_extension_shelf_visible = IsExtensionShelfAlwaysVisible(); | 2300 bool was_extension_shelf_visible = IsExtensionShelfAlwaysVisible(); |
2312 | 2301 |
2313 render_manager_.DidNavigateMainFrame(rvh); | 2302 render_manager_.DidNavigateMainFrame(rvh); |
2314 | 2303 |
2315 if (was_bookmark_bar_visible != ShouldShowBookmarkBar()) | 2304 if (was_bookmark_bar_visible != ShouldShowBookmarkBar()) |
2316 extra_invalidate_flags |= INVALIDATE_BOOKMARK_BAR; | 2305 extra_invalidate_flags |= INVALIDATE_BOOKMARK_BAR; |
2317 if (was_extension_shelf_visible != IsExtensionShelfAlwaysVisible()) | 2306 if (was_extension_shelf_visible != IsExtensionShelfAlwaysVisible()) |
2318 extra_invalidate_flags |= INVALIDATE_EXTENSION_SHELF; | 2307 extra_invalidate_flags |= INVALIDATE_EXTENSION_SHELF; |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3177 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); | 3166 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); |
3178 } | 3167 } |
3179 | 3168 |
3180 Profile* TabContents::GetProfileForPasswordManager() { | 3169 Profile* TabContents::GetProfileForPasswordManager() { |
3181 return profile(); | 3170 return profile(); |
3182 } | 3171 } |
3183 | 3172 |
3184 bool TabContents::DidLastPageLoadEncounterSSLErrors() { | 3173 bool TabContents::DidLastPageLoadEncounterSSLErrors() { |
3185 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); | 3174 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); |
3186 } | 3175 } |
OLD | NEW |