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

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

Issue 10761: Rewire the throbber so that the timer for updating lives on BrowserView, not ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <windows.h> 5 #include <windows.h>
6 #include <shellapi.h> 6 #include <shellapi.h>
7 7
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 if (contents) { 387 if (contents) {
388 title = contents->GetTitle(); 388 title = contents->GetTitle();
389 FormatTitleForDisplay(&title); 389 FormatTitleForDisplay(&title);
390 } 390 }
391 if (title.empty()) 391 if (title.empty())
392 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); 392 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE);
393 393
394 return l10n_util::GetStringF(IDS_BROWSER_WINDOW_TITLE_FORMAT, title); 394 return l10n_util::GetStringF(IDS_BROWSER_WINDOW_TITLE_FORMAT, title);
395 } 395 }
396 396
397 bool Browser::IsCurrentPageLoading() const {
398 return GetSelectedTabContents()->is_loading();
sky 2008/11/14 22:07:21 Should no null check this?
399 }
400
397 // static 401 // static
398 void Browser::FormatTitleForDisplay(std::wstring* title) { 402 void Browser::FormatTitleForDisplay(std::wstring* title) {
399 size_t current_index = 0; 403 size_t current_index = 0;
400 size_t match_index; 404 size_t match_index;
401 while ((match_index = title->find(L'\n', current_index)) != 405 while ((match_index = title->find(L'\n', current_index)) !=
402 std::wstring::npos) { 406 std::wstring::npos) {
403 title->replace(match_index, 1, L""); 407 title->replace(match_index, 1, L"");
404 current_index = match_index; 408 current_index = match_index;
405 } 409 }
406 } 410 }
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 PageTransition::LINK); 1330 PageTransition::LINK);
1327 } 1331 }
1328 1332
1329 if (profile_->HasSessionService()) { 1333 if (profile_->HasSessionService()) {
1330 SessionService* session_service = profile_->GetSessionService(); 1334 SessionService* session_service = profile_->GetSessionService();
1331 if (session_service) 1335 if (session_service)
1332 session_service->TabRestored(new_contents->controller()); 1336 session_service->TabRestored(new_contents->controller());
1333 } 1337 }
1334 } 1338 }
1335 1339
1336 void Browser::ValidateLoadingAnimations() {
1337 // TODO(beng): Remove this, per http://crbug.com/3297
1338 if (window_)
1339 window_->ValidateThrobber();
1340 }
1341
1342 void Browser::CloseFrameAfterDragSession() { 1340 void Browser::CloseFrameAfterDragSession() {
1343 // This is scheduled to run after we return to the message loop because 1341 // This is scheduled to run after we return to the message loop because
1344 // otherwise the frame will think the drag session is still active and ignore 1342 // otherwise the frame will think the drag session is still active and ignore
1345 // the request. 1343 // the request.
1346 MessageLoop::current()->PostTask(FROM_HERE, 1344 MessageLoop::current()->PostTask(FROM_HERE,
1347 method_factory_.NewRunnableMethod(&Browser::CloseFrame)); 1345 method_factory_.NewRunnableMethod(&Browser::CloseFrame));
1348 } 1346 }
1349 1347
1350 /////////////////////////////////////////////////////////////////////////////// 1348 ///////////////////////////////////////////////////////////////////////////////
1351 // Browser, TabStripModelObserver implementation: 1349 // Browser, TabStripModelObserver implementation:
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 } 1675 }
1678 } 1676 }
1679 1677
1680 void Browser::ActivateContents(TabContents* contents) { 1678 void Browser::ActivateContents(TabContents* contents) {
1681 tabstrip_model_.SelectTabContentsAt( 1679 tabstrip_model_.SelectTabContentsAt(
1682 tabstrip_model_.GetIndexOfTabContents(contents), false); 1680 tabstrip_model_.GetIndexOfTabContents(contents), false);
1683 window_->Activate(); 1681 window_->Activate();
1684 } 1682 }
1685 1683
1686 void Browser::LoadingStateChanged(TabContents* source) { 1684 void Browser::LoadingStateChanged(TabContents* source) {
1687 tabstrip_model_.UpdateTabContentsLoadingAnimations(); 1685 window_->UpdateLoadingAnimations(tabstrip_model_.TabsAreLoading());
1688
1689 window_->UpdateTitleBar(); 1686 window_->UpdateTitleBar();
1690 1687
1691 // Let the go button know that it should change appearance if possible. 1688 // Let the go button know that it should change appearance if possible.
1692 if (source == GetSelectedTabContents()) { 1689 if (source == GetSelectedTabContents()) {
1693 GetGoButton()->ScheduleChangeMode( 1690 GetGoButton()->ScheduleChangeMode(
1694 source->is_loading() ? GoButton::MODE_STOP : GoButton::MODE_GO); 1691 source->is_loading() ? GoButton::MODE_STOP : GoButton::MODE_GO);
1695 1692
1696 GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); 1693 GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText());
1697 } 1694 }
1698 } 1695 }
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 2390
2394 // We need to register the window position pref. 2391 // We need to register the window position pref.
2395 std::wstring window_pref(prefs::kBrowserWindowPlacement); 2392 std::wstring window_pref(prefs::kBrowserWindowPlacement);
2396 window_pref.append(L"_"); 2393 window_pref.append(L"_");
2397 window_pref.append(app_name); 2394 window_pref.append(app_name);
2398 PrefService* prefs = g_browser_process->local_state(); 2395 PrefService* prefs = g_browser_process->local_state();
2399 DCHECK(prefs); 2396 DCHECK(prefs);
2400 2397
2401 prefs->RegisterDictionaryPref(window_pref.c_str()); 2398 prefs->RegisterDictionaryPref(window_pref.c_str());
2402 } 2399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698