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 "app/animation.h" | 7 #include "app/animation.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/scoped_clipboard_writer.h" | |
13 #include "base/string_util.h" | 12 #include "base/string_util.h" |
14 #include "base/thread.h" | 13 #include "base/thread.h" |
15 #include "chrome/app/chrome_dll_resource.h" | 14 #include "chrome/app/chrome_dll_resource.h" |
16 #include "chrome/browser/bookmarks/bookmark_model.h" | 15 #include "chrome/browser/bookmarks/bookmark_model.h" |
17 #include "chrome/browser/browser_list.h" | 16 #include "chrome/browser/browser_list.h" |
18 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/browser_shutdown.h" | 18 #include "chrome/browser/browser_shutdown.h" |
20 #include "chrome/browser/browser_window.h" | 19 #include "chrome/browser/browser_window.h" |
21 #include "chrome/browser/character_encoding.h" | 20 #include "chrome/browser/character_encoding.h" |
22 #include "chrome/browser/debugger/devtools_manager.h" | 21 #include "chrome/browser/debugger/devtools_manager.h" |
23 #include "chrome/browser/download/download_item_model.h" | 22 #include "chrome/browser/download/download_item_model.h" |
24 #include "chrome/browser/download/download_manager.h" | 23 #include "chrome/browser/download/download_manager.h" |
25 #include "chrome/browser/download/download_shelf.h" | 24 #include "chrome/browser/download/download_shelf.h" |
26 #include "chrome/browser/download/download_started_animation.h" | 25 #include "chrome/browser/download/download_started_animation.h" |
27 #include "chrome/browser/extensions/crashed_extension_infobar.h" | 26 #include "chrome/browser/extensions/crashed_extension_infobar.h" |
28 #include "chrome/browser/extensions/extension_browser_event_router.h" | 27 #include "chrome/browser/extensions/extension_browser_event_router.h" |
29 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" | 28 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" |
30 #include "chrome/browser/extensions/extension_tabs_module.h" | 29 #include "chrome/browser/extensions/extension_tabs_module.h" |
31 #include "chrome/browser/extensions/extensions_service.h" | 30 #include "chrome/browser/extensions/extensions_service.h" |
32 #include "chrome/browser/find_bar.h" | 31 #include "chrome/browser/find_bar.h" |
33 #include "chrome/browser/find_bar_controller.h" | 32 #include "chrome/browser/find_bar_controller.h" |
34 #include "chrome/browser/google_url_tracker.h" | 33 #include "chrome/browser/google_url_tracker.h" |
35 #include "chrome/browser/location_bar.h" | 34 #include "chrome/browser/location_bar.h" |
36 #include "chrome/browser/metrics/user_metrics.h" | 35 #include "chrome/browser/metrics/user_metrics.h" |
| 36 #include "chrome/browser/net/browser_url_util.h" |
37 #include "chrome/browser/net/url_fixer_upper.h" | 37 #include "chrome/browser/net/url_fixer_upper.h" |
38 #include "chrome/browser/options_window.h" | 38 #include "chrome/browser/options_window.h" |
39 #include "chrome/browser/profile.h" | 39 #include "chrome/browser/profile.h" |
40 #include "chrome/browser/renderer_host/site_instance.h" | 40 #include "chrome/browser/renderer_host/site_instance.h" |
41 #include "chrome/browser/sessions/session_service.h" | 41 #include "chrome/browser/sessions/session_service.h" |
42 #include "chrome/browser/sessions/session_types.h" | 42 #include "chrome/browser/sessions/session_types.h" |
43 #include "chrome/browser/sessions/tab_restore_service.h" | 43 #include "chrome/browser/sessions/tab_restore_service.h" |
44 #include "chrome/browser/status_bubble.h" | 44 #include "chrome/browser/status_bubble.h" |
45 #include "chrome/browser/tab_contents/interstitial_page.h" | 45 #include "chrome/browser/tab_contents/interstitial_page.h" |
46 #include "chrome/browser/tab_contents/navigation_controller.h" | 46 #include "chrome/browser/tab_contents/navigation_controller.h" |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 void Browser::WriteCurrentURLToClipboard() { | 860 void Browser::WriteCurrentURLToClipboard() { |
861 // TODO(ericu): There isn't currently a metric for this. Should there be? | 861 // TODO(ericu): There isn't currently a metric for this. Should there be? |
862 // We don't appear to track the action when it comes from the | 862 // We don't appear to track the action when it comes from the |
863 // RenderContextViewMenu. | 863 // RenderContextViewMenu. |
864 // UserMetrics::RecordAction(L"$Metric_Name_Goes_Here$", profile_); | 864 // UserMetrics::RecordAction(L"$Metric_Name_Goes_Here$", profile_); |
865 | 865 |
866 TabContents* contents = GetSelectedTabContents(); | 866 TabContents* contents = GetSelectedTabContents(); |
867 if (!contents->ShouldDisplayURL()) | 867 if (!contents->ShouldDisplayURL()) |
868 return; | 868 return; |
869 | 869 |
870 net::WriteURLToClipboard( | 870 chrome_browser_net::WriteURLToClipboard( |
871 contents->GetURL(), | 871 contents->GetURL(), |
872 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 872 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
873 g_browser_process->clipboard()); | 873 g_browser_process->clipboard()); |
874 } | 874 } |
875 | 875 |
876 void Browser::ConvertPopupToTabbedBrowser() { | 876 void Browser::ConvertPopupToTabbedBrowser() { |
877 UserMetrics::RecordAction(L"ShowAsTab", profile_); | 877 UserMetrics::RecordAction(L"ShowAsTab", profile_); |
878 int tab_strip_index = tabstrip_model_.selected_index(); | 878 int tab_strip_index = tabstrip_model_.selected_index(); |
879 TabContents* contents = tabstrip_model_.DetachTabContentsAt(tab_strip_index); | 879 TabContents* contents = tabstrip_model_.DetachTabContentsAt(tab_strip_index); |
880 Browser* browser = Browser::Create(profile_); | 880 Browser* browser = Browser::Create(profile_); |
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2964 /////////////////////////////////////////////////////////////////////////////// | 2964 /////////////////////////////////////////////////////////////////////////////// |
2965 // BrowserToolbarModel (private): | 2965 // BrowserToolbarModel (private): |
2966 | 2966 |
2967 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2967 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
2968 // This |current_tab| can be NULL during the initialization of the | 2968 // This |current_tab| can be NULL during the initialization of the |
2969 // toolbar during window creation (i.e. before any tabs have been added | 2969 // toolbar during window creation (i.e. before any tabs have been added |
2970 // to the window). | 2970 // to the window). |
2971 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2971 TabContents* current_tab = browser_->GetSelectedTabContents(); |
2972 return current_tab ? ¤t_tab->controller() : NULL; | 2972 return current_tab ? ¤t_tab->controller() : NULL; |
2973 } | 2973 } |
OLD | NEW |