Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 211050: Implemented upload progress indicator in status bar. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)), 233 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)),
234 select_file_dialog_(), 234 select_file_dialog_(),
235 pending_install_(), 235 pending_install_(),
236 is_loading_(false), 236 is_loading_(false),
237 is_crashed_(false), 237 is_crashed_(false),
238 waiting_for_response_(false), 238 waiting_for_response_(false),
239 max_page_id_(-1), 239 max_page_id_(-1),
240 current_load_start_(), 240 current_load_start_(),
241 load_state_(net::LOAD_STATE_IDLE), 241 load_state_(net::LOAD_STATE_IDLE),
242 load_state_host_(), 242 load_state_host_(),
243 upload_size_(0),
244 upload_position_(0),
243 received_page_title_(false), 245 received_page_title_(false),
244 is_starred_(false), 246 is_starred_(false),
245 contents_mime_type_(), 247 contents_mime_type_(),
246 encoding_(), 248 encoding_(),
247 blocked_popups_(NULL), 249 blocked_popups_(NULL),
248 infobar_delegates_(), 250 infobar_delegates_(),
249 find_ui_active_(false), 251 find_ui_active_(false),
250 find_op_aborted_(false), 252 find_op_aborted_(false),
251 current_find_request_id_(find_request_id_counter_++), 253 current_find_request_id_(find_request_id_counter_++),
252 find_text_(), 254 find_text_(),
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 switch (load_state_) { 551 switch (load_state_) {
550 case net::LOAD_STATE_WAITING_FOR_CACHE: 552 case net::LOAD_STATE_WAITING_FOR_CACHE:
551 return l10n_util::GetString(IDS_LOAD_STATE_WAITING_FOR_CACHE); 553 return l10n_util::GetString(IDS_LOAD_STATE_WAITING_FOR_CACHE);
552 case net::LOAD_STATE_RESOLVING_PROXY_FOR_URL: 554 case net::LOAD_STATE_RESOLVING_PROXY_FOR_URL:
553 return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_PROXY_FOR_URL); 555 return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_PROXY_FOR_URL);
554 case net::LOAD_STATE_RESOLVING_HOST: 556 case net::LOAD_STATE_RESOLVING_HOST:
555 return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_HOST); 557 return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_HOST);
556 case net::LOAD_STATE_CONNECTING: 558 case net::LOAD_STATE_CONNECTING:
557 return l10n_util::GetString(IDS_LOAD_STATE_CONNECTING); 559 return l10n_util::GetString(IDS_LOAD_STATE_CONNECTING);
558 case net::LOAD_STATE_SENDING_REQUEST: 560 case net::LOAD_STATE_SENDING_REQUEST:
559 return l10n_util::GetString(IDS_LOAD_STATE_SENDING_REQUEST); 561 if (upload_size_)
562 return l10n_util::GetStringF(
563 IDS_LOAD_STATE_SENDING_REQUEST_WITH_PROGRESS,
564 static_cast<int>((100 * upload_position_) / upload_size_));
565 else
566 return l10n_util::GetString(IDS_LOAD_STATE_SENDING_REQUEST);
560 case net::LOAD_STATE_WAITING_FOR_RESPONSE: 567 case net::LOAD_STATE_WAITING_FOR_RESPONSE:
561 return l10n_util::GetStringF(IDS_LOAD_STATE_WAITING_FOR_RESPONSE, 568 return l10n_util::GetStringF(IDS_LOAD_STATE_WAITING_FOR_RESPONSE,
562 load_state_host_); 569 load_state_host_);
563 // Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE 570 // Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE
564 case net::LOAD_STATE_IDLE: 571 case net::LOAD_STATE_IDLE:
565 case net::LOAD_STATE_READING_RESPONSE: 572 case net::LOAD_STATE_READING_RESPONSE:
566 break; 573 break;
567 } 574 }
568 575
569 return std::wstring(); 576 return std::wstring();
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 // Notifies the RenderWidgetHost instance about the fact that the page is 1164 // Notifies the RenderWidgetHost instance about the fact that the page is
1158 // loading, or done loading and calls the base implementation. 1165 // loading, or done loading and calls the base implementation.
1159 void TabContents::SetIsLoading(bool is_loading, 1166 void TabContents::SetIsLoading(bool is_loading,
1160 LoadNotificationDetails* details) { 1167 LoadNotificationDetails* details) {
1161 if (is_loading == is_loading_) 1168 if (is_loading == is_loading_)
1162 return; 1169 return;
1163 1170
1164 if (!is_loading) { 1171 if (!is_loading) {
1165 load_state_ = net::LOAD_STATE_IDLE; 1172 load_state_ = net::LOAD_STATE_IDLE;
1166 load_state_host_.clear(); 1173 load_state_host_.clear();
1174 upload_size_ = 0;
1175 upload_position_ = 0;
1167 } 1176 }
1168 1177
1169 render_manager_.SetIsLoading(is_loading); 1178 render_manager_.SetIsLoading(is_loading);
1170 1179
1171 is_loading_ = is_loading; 1180 is_loading_ = is_loading;
1172 waiting_for_response_ = is_loading; 1181 waiting_for_response_ = is_loading;
1173 1182
1174 if (delegate_) 1183 if (delegate_)
1175 delegate_->LoadingStateChanged(this); 1184 delegate_->LoadingStateChanged(this);
1176 NotifyNavigationStateChanged(INVALIDATE_LOAD); 1185 NotifyNavigationStateChanged(INVALIDATE_LOAD);
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 2388
2380 if (render_view_host() && render_view_host()->IsRenderViewLive()) 2389 if (render_view_host() && render_view_host()->IsRenderViewLive())
2381 HungRendererDialog::ShowForTabContents(this); 2390 HungRendererDialog::ShowForTabContents(this);
2382 } 2391 }
2383 2392
2384 void TabContents::RendererResponsive(RenderViewHost* render_view_host) { 2393 void TabContents::RendererResponsive(RenderViewHost* render_view_host) {
2385 HungRendererDialog::HideForTabContents(this); 2394 HungRendererDialog::HideForTabContents(this);
2386 } 2395 }
2387 2396
2388 void TabContents::LoadStateChanged(const GURL& url, 2397 void TabContents::LoadStateChanged(const GURL& url,
2389 net::LoadState load_state) { 2398 net::LoadState load_state,
2399 uint64 upload_position,
2400 uint64 upload_size) {
2390 load_state_ = load_state; 2401 load_state_ = load_state;
2402 upload_position_ = upload_position;
2403 upload_size_ = upload_size;
2391 std::wstring languages = 2404 std::wstring languages =
2392 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); 2405 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages);
2393 load_state_host_.clear(); 2406 load_state_host_.clear();
2394 std::string host = url.host(); 2407 std::string host = url.host();
2395 net::IDNToUnicode(host.c_str(), host.size(), languages, &load_state_host_); 2408 net::IDNToUnicode(host.c_str(), host.size(), languages, &load_state_host_);
2396 if (load_state_ == net::LOAD_STATE_READING_RESPONSE) 2409 if (load_state_ == net::LOAD_STATE_READING_RESPONSE)
2397 SetNotWaitingForResponse(); 2410 SetNotWaitingForResponse();
2398 if (is_loading()) 2411 if (is_loading())
2399 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); 2412 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB);
2400 } 2413 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 2539
2527 default: 2540 default:
2528 NOTREACHED(); 2541 NOTREACHED();
2529 } 2542 }
2530 } 2543 }
2531 2544
2532 void TabContents::set_encoding(const std::string& encoding) { 2545 void TabContents::set_encoding(const std::string& encoding) {
2533 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); 2546 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding);
2534 } 2547 }
2535 2548
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698