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