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 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 Details<PageTranslatedDetails>(&details)); | 2086 Details<PageTranslatedDetails>(&details)); |
2087 } | 2087 } |
2088 | 2088 |
2089 void TabContents::OnSetSuggestResult(int32 page_id, const std::string& result) { | 2089 void TabContents::OnSetSuggestResult(int32 page_id, const std::string& result) { |
2090 if (delegate()) | 2090 if (delegate()) |
2091 delegate()->OnSetSuggestResult(page_id, result); | 2091 delegate()->OnSetSuggestResult(page_id, result); |
2092 } | 2092 } |
2093 | 2093 |
2094 void TabContents::DidStartProvisionalLoadForFrame( | 2094 void TabContents::DidStartProvisionalLoadForFrame( |
2095 RenderViewHost* render_view_host, | 2095 RenderViewHost* render_view_host, |
| 2096 long long frame_id, |
2096 bool is_main_frame, | 2097 bool is_main_frame, |
2097 const GURL& url) { | 2098 const GURL& url) { |
2098 ProvisionalLoadDetails details(is_main_frame, | 2099 ProvisionalLoadDetails details(is_main_frame, |
2099 controller_.IsURLInPageNavigation(url), | 2100 controller_.IsURLInPageNavigation(url), |
2100 url, std::string(), false); | 2101 url, std::string(), false, frame_id); |
2101 NotificationService::current()->Notify( | 2102 NotificationService::current()->Notify( |
2102 NotificationType::FRAME_PROVISIONAL_LOAD_START, | 2103 NotificationType::FRAME_PROVISIONAL_LOAD_START, |
2103 Source<NavigationController>(&controller_), | 2104 Source<NavigationController>(&controller_), |
2104 Details<ProvisionalLoadDetails>(&details)); | 2105 Details<ProvisionalLoadDetails>(&details)); |
2105 if (is_main_frame) { | 2106 if (is_main_frame) { |
2106 content_settings_delegate_->ClearCookieSpecificContentSettings(); | 2107 content_settings_delegate_->ClearCookieSpecificContentSettings(); |
2107 content_settings_delegate_->ClearGeolocationContentSettings(); | 2108 content_settings_delegate_->ClearGeolocationContentSettings(); |
2108 } | 2109 } |
2109 } | 2110 } |
2110 | 2111 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 displayed_insecure_content_ = true; | 2150 displayed_insecure_content_ = true; |
2150 SSLManager::NotifySSLInternalStateChanged(); | 2151 SSLManager::NotifySSLInternalStateChanged(); |
2151 } | 2152 } |
2152 | 2153 |
2153 void TabContents::DidRunInsecureContent(const std::string& security_origin) { | 2154 void TabContents::DidRunInsecureContent(const std::string& security_origin) { |
2154 controller_.ssl_manager()->DidRunInsecureContent(security_origin); | 2155 controller_.ssl_manager()->DidRunInsecureContent(security_origin); |
2155 } | 2156 } |
2156 | 2157 |
2157 void TabContents::DidFailProvisionalLoadWithError( | 2158 void TabContents::DidFailProvisionalLoadWithError( |
2158 RenderViewHost* render_view_host, | 2159 RenderViewHost* render_view_host, |
| 2160 long long frame_id, |
2159 bool is_main_frame, | 2161 bool is_main_frame, |
2160 int error_code, | 2162 int error_code, |
2161 const GURL& url, | 2163 const GURL& url, |
2162 bool showing_repost_interstitial) { | 2164 bool showing_repost_interstitial) { |
2163 if (net::ERR_ABORTED == error_code) { | 2165 if (net::ERR_ABORTED == error_code) { |
2164 // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials. | 2166 // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials. |
2165 // This means that the interstitial won't be torn down properly, which is | 2167 // This means that the interstitial won't be torn down properly, which is |
2166 // bad. But if we have an interstitial, go back to another tab type, and | 2168 // bad. But if we have an interstitial, go back to another tab type, and |
2167 // then load the same interstitial again, we could end up getting the first | 2169 // then load the same interstitial again, we could end up getting the first |
2168 // interstitial's "failed" message (as a result of the cancel) when we're on | 2170 // interstitial's "failed" message (as a result of the cancel) when we're on |
(...skipping 25 matching lines...) Expand all Loading... |
2194 // Update the URL display. | 2196 // Update the URL display. |
2195 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL); | 2197 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL); |
2196 } | 2198 } |
2197 | 2199 |
2198 render_manager_.RendererAbortedProvisionalLoad(render_view_host); | 2200 render_manager_.RendererAbortedProvisionalLoad(render_view_host); |
2199 } | 2201 } |
2200 | 2202 |
2201 // Send out a notification that we failed a provisional load with an error. | 2203 // Send out a notification that we failed a provisional load with an error. |
2202 ProvisionalLoadDetails details(is_main_frame, | 2204 ProvisionalLoadDetails details(is_main_frame, |
2203 controller_.IsURLInPageNavigation(url), | 2205 controller_.IsURLInPageNavigation(url), |
2204 url, std::string(), false); | 2206 url, std::string(), false, frame_id); |
2205 details.set_error_code(error_code); | 2207 details.set_error_code(error_code); |
2206 | 2208 |
2207 NotificationService::current()->Notify( | 2209 NotificationService::current()->Notify( |
2208 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 2210 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
2209 Source<NavigationController>(&controller_), | 2211 Source<NavigationController>(&controller_), |
2210 Details<ProvisionalLoadDetails>(&details)); | 2212 Details<ProvisionalLoadDetails>(&details)); |
2211 } | 2213 } |
2212 | 2214 |
2213 void TabContents::DocumentLoadedInFrame() { | 2215 void TabContents::DocumentLoadedInFrame() { |
2214 controller_.DocumentLoadedInFrame(); | 2216 controller_.DocumentLoadedInFrame(); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 contents_mime_type_ = params.contents_mime_type; | 2424 contents_mime_type_ = params.contents_mime_type; |
2423 | 2425 |
2424 NavigationController::LoadCommittedDetails details; | 2426 NavigationController::LoadCommittedDetails details; |
2425 bool did_navigate = controller_.RendererDidNavigate( | 2427 bool did_navigate = controller_.RendererDidNavigate( |
2426 params, extra_invalidate_flags, &details); | 2428 params, extra_invalidate_flags, &details); |
2427 | 2429 |
2428 // Send notification about committed provisional loads. This notification is | 2430 // Send notification about committed provisional loads. This notification is |
2429 // different from the NAV_ENTRY_COMMITTED notification which doesn't include | 2431 // different from the NAV_ENTRY_COMMITTED notification which doesn't include |
2430 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. | 2432 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. |
2431 if (details.type != NavigationType::NAV_IGNORE) { | 2433 if (details.type != NavigationType::NAV_IGNORE) { |
2432 ProvisionalLoadDetails load_details(details.is_main_frame, | 2434 // For AUTO_SUBFRAME navigations, an event for the main frame is generated |
2433 details.is_in_page, | 2435 // that is not recorded in the navigation history. For the purpose of |
2434 params.url, std::string(), false); | 2436 // tracking navigation events, we treat this event as a sub frame navigation |
| 2437 // event. |
| 2438 bool is_main_frame = did_navigate ? details.is_main_frame : false; |
| 2439 ProvisionalLoadDetails load_details( |
| 2440 is_main_frame, details.is_in_page, params.url, std::string(), false, |
| 2441 params.frame_id); |
2435 load_details.set_transition_type(params.transition); | 2442 load_details.set_transition_type(params.transition); |
2436 // Whether or not a page transition was triggered by going backward or | 2443 // Whether or not a page transition was triggered by going backward or |
2437 // forward in the history is only stored in the navigation controller's | 2444 // forward in the history is only stored in the navigation controller's |
2438 // entry list. | 2445 // entry list. |
2439 if (did_navigate && | 2446 if (did_navigate && |
2440 (controller_.GetActiveEntry()->transition_type() & | 2447 (controller_.GetActiveEntry()->transition_type() & |
2441 PageTransition::FORWARD_BACK)) { | 2448 PageTransition::FORWARD_BACK)) { |
2442 load_details.set_transition_type( | 2449 load_details.set_transition_type( |
2443 params.transition | PageTransition::FORWARD_BACK); | 2450 params.transition | PageTransition::FORWARD_BACK); |
2444 } | 2451 } |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3271 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); | 3278 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); |
3272 } | 3279 } |
3273 | 3280 |
3274 Profile* TabContents::GetProfileForPasswordManager() { | 3281 Profile* TabContents::GetProfileForPasswordManager() { |
3275 return profile(); | 3282 return profile(); |
3276 } | 3283 } |
3277 | 3284 |
3278 bool TabContents::DidLastPageLoadEncounterSSLErrors() { | 3285 bool TabContents::DidLastPageLoadEncounterSSLErrors() { |
3279 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); | 3286 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); |
3280 } | 3287 } |
OLD | NEW |