OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)), | 230 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)), |
231 select_file_dialog_(), | 231 select_file_dialog_(), |
232 pending_install_(), | 232 pending_install_(), |
233 is_loading_(false), | 233 is_loading_(false), |
234 is_crashed_(false), | 234 is_crashed_(false), |
235 waiting_for_response_(false), | 235 waiting_for_response_(false), |
236 max_page_id_(-1), | 236 max_page_id_(-1), |
237 current_load_start_(), | 237 current_load_start_(), |
238 load_state_(net::LOAD_STATE_IDLE), | 238 load_state_(net::LOAD_STATE_IDLE), |
239 load_state_host_(), | 239 load_state_host_(), |
| 240 upload_size_(0), |
| 241 upload_position_(0), |
240 received_page_title_(false), | 242 received_page_title_(false), |
241 is_starred_(false), | 243 is_starred_(false), |
242 contents_mime_type_(), | 244 contents_mime_type_(), |
243 encoding_(), | 245 encoding_(), |
244 blocked_popups_(NULL), | 246 blocked_popups_(NULL), |
245 infobar_delegates_(), | 247 infobar_delegates_(), |
246 find_ui_active_(false), | 248 find_ui_active_(false), |
247 find_op_aborted_(false), | 249 find_op_aborted_(false), |
248 current_find_request_id_(find_request_id_counter_++), | 250 current_find_request_id_(find_request_id_counter_++), |
249 find_text_(), | 251 find_text_(), |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 switch (load_state_) { | 548 switch (load_state_) { |
547 case net::LOAD_STATE_WAITING_FOR_CACHE: | 549 case net::LOAD_STATE_WAITING_FOR_CACHE: |
548 return l10n_util::GetString(IDS_LOAD_STATE_WAITING_FOR_CACHE); | 550 return l10n_util::GetString(IDS_LOAD_STATE_WAITING_FOR_CACHE); |
549 case net::LOAD_STATE_RESOLVING_PROXY_FOR_URL: | 551 case net::LOAD_STATE_RESOLVING_PROXY_FOR_URL: |
550 return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_PROXY_FOR_URL); | 552 return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_PROXY_FOR_URL); |
551 case net::LOAD_STATE_RESOLVING_HOST: | 553 case net::LOAD_STATE_RESOLVING_HOST: |
552 return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_HOST); | 554 return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_HOST); |
553 case net::LOAD_STATE_CONNECTING: | 555 case net::LOAD_STATE_CONNECTING: |
554 return l10n_util::GetString(IDS_LOAD_STATE_CONNECTING); | 556 return l10n_util::GetString(IDS_LOAD_STATE_CONNECTING); |
555 case net::LOAD_STATE_SENDING_REQUEST: | 557 case net::LOAD_STATE_SENDING_REQUEST: |
556 return l10n_util::GetString(IDS_LOAD_STATE_SENDING_REQUEST); | 558 if (upload_size_) |
| 559 return l10n_util::GetStringF( |
| 560 IDS_LOAD_STATE_SENDING_REQUEST_WITH_PROGRESS, |
| 561 static_cast<int>((100 * upload_position_) / upload_size_)); |
| 562 else |
| 563 return l10n_util::GetString(IDS_LOAD_STATE_SENDING_REQUEST); |
557 case net::LOAD_STATE_WAITING_FOR_RESPONSE: | 564 case net::LOAD_STATE_WAITING_FOR_RESPONSE: |
558 return l10n_util::GetStringF(IDS_LOAD_STATE_WAITING_FOR_RESPONSE, | 565 return l10n_util::GetStringF(IDS_LOAD_STATE_WAITING_FOR_RESPONSE, |
559 load_state_host_); | 566 load_state_host_); |
560 // Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE | 567 // Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE |
561 case net::LOAD_STATE_IDLE: | 568 case net::LOAD_STATE_IDLE: |
562 case net::LOAD_STATE_READING_RESPONSE: | 569 case net::LOAD_STATE_READING_RESPONSE: |
563 break; | 570 break; |
564 } | 571 } |
565 | 572 |
566 return std::wstring(); | 573 return std::wstring(); |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 // Notifies the RenderWidgetHost instance about the fact that the page is | 1161 // Notifies the RenderWidgetHost instance about the fact that the page is |
1155 // loading, or done loading and calls the base implementation. | 1162 // loading, or done loading and calls the base implementation. |
1156 void TabContents::SetIsLoading(bool is_loading, | 1163 void TabContents::SetIsLoading(bool is_loading, |
1157 LoadNotificationDetails* details) { | 1164 LoadNotificationDetails* details) { |
1158 if (is_loading == is_loading_) | 1165 if (is_loading == is_loading_) |
1159 return; | 1166 return; |
1160 | 1167 |
1161 if (!is_loading) { | 1168 if (!is_loading) { |
1162 load_state_ = net::LOAD_STATE_IDLE; | 1169 load_state_ = net::LOAD_STATE_IDLE; |
1163 load_state_host_.clear(); | 1170 load_state_host_.clear(); |
| 1171 upload_size_ = 0; |
| 1172 upload_position_ = 0; |
1164 } | 1173 } |
1165 | 1174 |
1166 render_manager_.SetIsLoading(is_loading); | 1175 render_manager_.SetIsLoading(is_loading); |
1167 | 1176 |
1168 is_loading_ = is_loading; | 1177 is_loading_ = is_loading; |
1169 waiting_for_response_ = is_loading; | 1178 waiting_for_response_ = is_loading; |
1170 | 1179 |
1171 if (delegate_) | 1180 if (delegate_) |
1172 delegate_->LoadingStateChanged(this); | 1181 delegate_->LoadingStateChanged(this); |
1173 NotifyNavigationStateChanged(INVALIDATE_LOAD); | 1182 NotifyNavigationStateChanged(INVALIDATE_LOAD); |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 | 2386 |
2378 if (render_view_host() && render_view_host()->IsRenderViewLive()) | 2387 if (render_view_host() && render_view_host()->IsRenderViewLive()) |
2379 HungRendererDialog::ShowForTabContents(this); | 2388 HungRendererDialog::ShowForTabContents(this); |
2380 } | 2389 } |
2381 | 2390 |
2382 void TabContents::RendererResponsive(RenderViewHost* render_view_host) { | 2391 void TabContents::RendererResponsive(RenderViewHost* render_view_host) { |
2383 HungRendererDialog::HideForTabContents(this); | 2392 HungRendererDialog::HideForTabContents(this); |
2384 } | 2393 } |
2385 | 2394 |
2386 void TabContents::LoadStateChanged(const GURL& url, | 2395 void TabContents::LoadStateChanged(const GURL& url, |
2387 net::LoadState load_state) { | 2396 net::LoadState load_state, |
| 2397 uint64 upload_position, |
| 2398 uint64 upload_size) { |
2388 load_state_ = load_state; | 2399 load_state_ = load_state; |
| 2400 upload_position_ = upload_position; |
| 2401 upload_size_ = upload_size; |
2389 std::wstring languages = | 2402 std::wstring languages = |
2390 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); | 2403 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); |
2391 load_state_host_.clear(); | 2404 load_state_host_.clear(); |
2392 std::string host = url.host(); | 2405 std::string host = url.host(); |
2393 net::IDNToUnicode(host.c_str(), host.size(), languages, &load_state_host_); | 2406 net::IDNToUnicode(host.c_str(), host.size(), languages, &load_state_host_); |
2394 if (load_state_ == net::LOAD_STATE_READING_RESPONSE) | 2407 if (load_state_ == net::LOAD_STATE_READING_RESPONSE) |
2395 SetNotWaitingForResponse(); | 2408 SetNotWaitingForResponse(); |
2396 if (is_loading()) | 2409 if (is_loading()) |
2397 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); | 2410 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); |
2398 } | 2411 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2524 | 2537 |
2525 default: | 2538 default: |
2526 NOTREACHED(); | 2539 NOTREACHED(); |
2527 } | 2540 } |
2528 } | 2541 } |
2529 | 2542 |
2530 void TabContents::set_encoding(const std::string& encoding) { | 2543 void TabContents::set_encoding(const std::string& encoding) { |
2531 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2544 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
2532 } | 2545 } |
2533 | 2546 |
OLD | NEW |