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

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

Issue 12863: Changed the Browser::Reload() function to check the url... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 12 years 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 | « no previous file | 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) 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 UserMetrics::RecordAction(L"Forward", profile_); 574 UserMetrics::RecordAction(L"Forward", profile_);
575 if (GetSelectedTabContents()->controller()->CanGoForward()) 575 if (GetSelectedTabContents()->controller()->CanGoForward())
576 GetSelectedTabContents()->controller()->GoForward(); 576 GetSelectedTabContents()->controller()->GoForward();
577 } 577 }
578 578
579 void Browser::Reload() { 579 void Browser::Reload() {
580 UserMetrics::RecordAction(L"Reload", profile_); 580 UserMetrics::RecordAction(L"Reload", profile_);
581 581
582 // If we are showing an interstitial, treat this as an OpenURL. 582 // If we are showing an interstitial, treat this as an OpenURL.
583 TabContents* current_tab = GetSelectedTabContents(); 583 TabContents* current_tab = GetSelectedTabContents();
584 std::wstring current_url;
585 LocationBarView* lbv = GetLocationBarView();
586 AutocompleteEditView* aev = NULL;
587
588 if ((lbv)&&(current_tab->ShouldDisplayURL())) {
589 aev = lbv->location_entry();
590 current_url = UTF8ToWide(current_tab->GetURL().spec());
591 }
592
584 if (current_tab) { 593 if (current_tab) {
585 WebContents* web_contents = current_tab->AsWebContents(); 594 WebContents* web_contents = current_tab->AsWebContents();
586 if (web_contents && web_contents->showing_interstitial_page()) { 595 if (web_contents && web_contents->showing_interstitial_page()) {
587 NavigationEntry* entry = current_tab->controller()->GetActiveEntry(); 596 NavigationEntry* entry = current_tab->controller()->GetActiveEntry();
588 DCHECK(entry); // Should exist if interstitial is showing. 597 DCHECK(entry); // Should exist if interstitial is showing.
589 OpenURL(entry->url(), GURL(), CURRENT_TAB, PageTransition::RELOAD); 598 OpenURL(entry->url(), GURL(), CURRENT_TAB, PageTransition::RELOAD);
599
600 if (aev) {
601 aev->SetWindowTextAndCaretPos(current_url, current_url.length() - 1);
602 }
590 return; 603 return;
591 } 604 }
592 } 605 }
593 606
594 if (current_tab) { 607 if (current_tab) {
595 // As this is caused by a user action, give the focus to the page. 608 // As this is caused by a user action, give the focus to the page.
596 current_tab->Focus(); 609 current_tab->Focus();
597 current_tab->controller()->Reload(true); 610 current_tab->controller()->Reload(true);
611
612 if (aev) {
613 aev->SetWindowTextAndCaretPos(current_url, current_url.length() - 1);
614 }
598 } 615 }
599 } 616 }
600 617
601 void Browser::Stop() { 618 void Browser::Stop() {
602 UserMetrics::RecordAction(L"Stop", profile_); 619 UserMetrics::RecordAction(L"Stop", profile_);
603 GetSelectedTabContents()->AsWebContents()->Stop(); 620 GetSelectedTabContents()->AsWebContents()->Stop();
604 } 621 }
605 622
606 void Browser::Home() { 623 void Browser::Home() {
607 UserMetrics::RecordAction(L"Home", profile_); 624 UserMetrics::RecordAction(L"Home", profile_);
(...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 g_app_names->insert(app_name); 2365 g_app_names->insert(app_name);
2349 2366
2350 // We need to register the window position pref. 2367 // We need to register the window position pref.
2351 std::wstring window_pref(prefs::kBrowserWindowPlacement); 2368 std::wstring window_pref(prefs::kBrowserWindowPlacement);
2352 window_pref.append(L"_"); 2369 window_pref.append(L"_");
2353 window_pref.append(app_name); 2370 window_pref.append(app_name);
2354 PrefService* prefs = g_browser_process->local_state(); 2371 PrefService* prefs = g_browser_process->local_state();
2355 DCHECK(prefs); 2372 DCHECK(prefs);
2356 2373
2357 prefs->RegisterDictionaryPref(window_pref.c_str()); 2374 prefs->RegisterDictionaryPref(window_pref.c_str());
2358 } 2375 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698