| OLD | NEW |
| 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 "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" |
| 11 #include "base/thread.h" | 11 #include "base/thread.h" |
| 12 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_dll_resource.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "chrome/browser/browser_list.h" | 14 #include "chrome/browser/browser_list.h" |
| 15 #include "chrome/browser/browser_shutdown.h" | 15 #include "chrome/browser/browser_shutdown.h" |
| 16 #include "chrome/browser/browser_window.h" | 16 #include "chrome/browser/browser_window.h" |
| 17 #include "chrome/browser/character_encoding.h" | 17 #include "chrome/browser/character_encoding.h" |
| 18 #include "chrome/browser/debugger/devtools_manager.h" | 18 #include "chrome/browser/debugger/devtools_manager.h" |
| 19 #include "chrome/browser/debugger/devtools_window.h" |
| 19 #include "chrome/browser/location_bar.h" | 20 #include "chrome/browser/location_bar.h" |
| 20 #include "chrome/browser/metrics/user_metrics.h" | 21 #include "chrome/browser/metrics/user_metrics.h" |
| 21 #include "chrome/browser/net/url_fixer_upper.h" | 22 #include "chrome/browser/net/url_fixer_upper.h" |
| 22 #include "chrome/browser/profile.h" | 23 #include "chrome/browser/profile.h" |
| 23 #include "chrome/browser/sessions/session_service.h" | 24 #include "chrome/browser/sessions/session_service.h" |
| 24 #include "chrome/browser/sessions/session_types.h" | 25 #include "chrome/browser/sessions/session_types.h" |
| 25 #include "chrome/browser/sessions/tab_restore_service.h" | 26 #include "chrome/browser/sessions/tab_restore_service.h" |
| 26 #include "chrome/browser/status_bubble.h" | 27 #include "chrome/browser/status_bubble.h" |
| 27 #include "chrome/browser/tab_contents/interstitial_page.h" | 28 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 28 #include "chrome/browser/tab_contents/navigation_controller.h" | 29 #include "chrome/browser/tab_contents/navigation_controller.h" |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 #if defined(OS_WIN) | 935 #if defined(OS_WIN) |
| 935 void Browser::OpenCreateShortcutsDialog() { | 936 void Browser::OpenCreateShortcutsDialog() { |
| 936 UserMetrics::RecordAction(L"CreateShortcut", profile_); | 937 UserMetrics::RecordAction(L"CreateShortcut", profile_); |
| 937 GetSelectedTabContents()->AsWebContents()->CreateShortcut(); | 938 GetSelectedTabContents()->AsWebContents()->CreateShortcut(); |
| 938 } | 939 } |
| 939 | 940 |
| 940 void Browser::OpenDebuggerWindow() { | 941 void Browser::OpenDebuggerWindow() { |
| 941 #ifndef CHROME_DEBUGGER_DISABLED | 942 #ifndef CHROME_DEBUGGER_DISABLED |
| 942 UserMetrics::RecordAction(L"Debugger", profile_); | 943 UserMetrics::RecordAction(L"Debugger", profile_); |
| 943 TabContents* current_tab = GetSelectedTabContents(); | 944 TabContents* current_tab = GetSelectedTabContents(); |
| 944 if (current_tab->AsWebContents()) { | 945 WebContents* wc = current_tab->AsWebContents(); |
| 946 if (wc) { |
| 945 if (CommandLine::ForCurrentProcess()->HasSwitch( | 947 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 946 switches::kEnableOutOfProcessDevTools)) { | 948 switches::kEnableOutOfProcessDevTools)) { |
| 947 WebContents* wc = current_tab->AsWebContents(); | 949 DevToolsManager* manager = g_browser_process->devtools_manager(); |
| 948 g_browser_process->devtools_manager()->ShowDevToolsForWebContents(wc); | 950 DevToolsClientHost* host = manager->GetDevToolsClientHostFor(*wc); |
| 951 if (!host) { |
| 952 host = DevToolsWindow::Create(); |
| 953 manager->RegisterDevToolsClientHostFor(*wc, host); |
| 954 } |
| 955 DevToolsWindow* window = host->AsDevToolsWindow(); |
| 956 if (window) |
| 957 window->Show(); |
| 949 } else { | 958 } else { |
| 950 // Only one debugger instance can exist at a time right now. | 959 // Only one debugger instance can exist at a time right now. |
| 951 // TODO(erikkay): need an alert, dialog, something | 960 // TODO(erikkay): need an alert, dialog, something |
| 952 // or better yet, fix the one instance limitation | 961 // or better yet, fix the one instance limitation |
| 953 if (!DebuggerWindow::DoesDebuggerExist()) | 962 if (!DebuggerWindow::DoesDebuggerExist()) |
| 954 debugger_window_ = new DebuggerWindow(); | 963 debugger_window_ = new DebuggerWindow(); |
| 955 debugger_window_->Show(current_tab); | 964 debugger_window_->Show(current_tab); |
| 956 } | 965 } |
| 957 } | 966 } |
| 958 #endif | 967 #endif |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2489 | 2498 |
| 2490 // We need to register the window position pref. | 2499 // We need to register the window position pref. |
| 2491 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2500 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
| 2492 window_pref.append(L"_"); | 2501 window_pref.append(L"_"); |
| 2493 window_pref.append(app_name); | 2502 window_pref.append(app_name); |
| 2494 PrefService* prefs = g_browser_process->local_state(); | 2503 PrefService* prefs = g_browser_process->local_state(); |
| 2495 DCHECK(prefs); | 2504 DCHECK(prefs); |
| 2496 | 2505 |
| 2497 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2506 prefs->RegisterDictionaryPref(window_pref.c_str()); |
| 2498 } | 2507 } |
| OLD | NEW |