| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/idle_timer.h" | 8 #include "base/idle_timer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 | 630 |
| 631 void Browser::Home(WindowOpenDisposition disposition) { | 631 void Browser::Home(WindowOpenDisposition disposition) { |
| 632 UserMetrics::RecordAction(L"Home", profile_); | 632 UserMetrics::RecordAction(L"Home", profile_); |
| 633 OpenURL(GetHomePage(), GURL(), disposition, PageTransition::AUTO_BOOKMARK); | 633 OpenURL(GetHomePage(), GURL(), disposition, PageTransition::AUTO_BOOKMARK); |
| 634 } | 634 } |
| 635 | 635 |
| 636 void Browser::OpenCurrentURL() { | 636 void Browser::OpenCurrentURL() { |
| 637 UserMetrics::RecordAction(L"LoadURL", profile_); | 637 UserMetrics::RecordAction(L"LoadURL", profile_); |
| 638 LocationBar* location_bar = window_->GetLocationBar(); | 638 LocationBar* location_bar = window_->GetLocationBar(); |
| 639 OpenURL(GURL(WideToUTF8(location_bar->GetInputString())), GURL(), | 639 OpenURL(GURL(WideToUTF8(location_bar->GetInputString())), GURL(), |
| 640 location_bar->GetWindowOpenDisposition(), | 640 location_bar->GetWindowOpenDisposition(), |
| 641 location_bar->GetPageTransition()); | 641 location_bar->GetPageTransition()); |
| 642 } | 642 } |
| 643 | 643 |
| 644 void Browser::Go(WindowOpenDisposition disposition) { | 644 void Browser::Go(WindowOpenDisposition disposition) { |
| 645 UserMetrics::RecordAction(L"Go", profile_); | 645 UserMetrics::RecordAction(L"Go", profile_); |
| 646 window_->GetLocationBar()->AcceptInputWithDisposition(disposition); | 646 window_->GetLocationBar()->AcceptInputWithDisposition(disposition); |
| 647 } | 647 } |
| 648 | 648 |
| 649 void Browser::Stop() { | 649 void Browser::Stop() { |
| 650 UserMetrics::RecordAction(L"Stop", profile_); | 650 UserMetrics::RecordAction(L"Stop", profile_); |
| 651 GetSelectedTabContents()->Stop(); | 651 GetSelectedTabContents()->Stop(); |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 NavigationController* controller = current_tab->controller(); | 1678 NavigationController* controller = current_tab->controller(); |
| 1679 controller->LoadURL(url, referrer, transition); | 1679 controller->LoadURL(url, referrer, transition); |
| 1680 // If the TabContents type has been swapped, we need to point to the current | 1680 // If the TabContents type has been swapped, we need to point to the current |
| 1681 // active type otherwise there will be weirdness. | 1681 // active type otherwise there will be weirdness. |
| 1682 new_contents = controller->active_contents(); | 1682 new_contents = controller->active_contents(); |
| 1683 if (GetStatusBubble()) | 1683 if (GetStatusBubble()) |
| 1684 GetStatusBubble()->Hide(); | 1684 GetStatusBubble()->Hide(); |
| 1685 | 1685 |
| 1686 // Update the location bar and load state. These are both synchronous | 1686 // Update the location bar and load state. These are both synchronous |
| 1687 // updates inside of ScheduleUIUpdate. | 1687 // updates inside of ScheduleUIUpdate. |
| 1688 ScheduleUIUpdate(source, TabContents::INVALIDATE_URL | | 1688 ScheduleUIUpdate(current_tab, TabContents::INVALIDATE_URL | |
| 1689 TabContents::INVALIDATE_LOAD); | 1689 TabContents::INVALIDATE_LOAD); |
| 1690 } else if (disposition == OFF_THE_RECORD) { | 1690 } else if (disposition == OFF_THE_RECORD) { |
| 1691 OpenURLOffTheRecord(profile_, url); | 1691 OpenURLOffTheRecord(profile_, url); |
| 1692 return; | 1692 return; |
| 1693 } else if (disposition != SUPPRESS_OPEN) { | 1693 } else if (disposition != SUPPRESS_OPEN) { |
| 1694 new_contents = AddTabWithURL(url, referrer, transition, | 1694 new_contents = AddTabWithURL(url, referrer, transition, |
| 1695 disposition != NEW_BACKGROUND_TAB, -1, | 1695 disposition != NEW_BACKGROUND_TAB, -1, |
| 1696 instance); | 1696 instance); |
| 1697 } | 1697 } |
| 1698 | 1698 |
| 1699 if (disposition != NEW_BACKGROUND_TAB && source_tab_was_frontmost) { | 1699 if (disposition != NEW_BACKGROUND_TAB && source_tab_was_frontmost) { |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 | 2549 |
| 2550 // We need to register the window position pref. | 2550 // We need to register the window position pref. |
| 2551 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2551 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
| 2552 window_pref.append(L"_"); | 2552 window_pref.append(L"_"); |
| 2553 window_pref.append(app_name); | 2553 window_pref.append(app_name); |
| 2554 PrefService* prefs = g_browser_process->local_state(); | 2554 PrefService* prefs = g_browser_process->local_state(); |
| 2555 DCHECK(prefs); | 2555 DCHECK(prefs); |
| 2556 | 2556 |
| 2557 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2557 prefs->RegisterDictionaryPref(window_pref.c_str()); |
| 2558 } | 2558 } |
| OLD | NEW |